Enabling the module forces portrait orientation - failure of WCAG SC 1.3.4

Created on 29 June 2021, almost 3 years ago
Updated 13 September 2023, 10 months ago

Follow-up to #3070058: Document how to specify the orientation parameter via alter hook β†’

Problem/Motivation

The 8.x-1.5 version of the module still outputs "orientation": "portrait" in manifest.json.

This causes the PWA to be locked to portrait orientation regardless of what the content is. The PWA user cannot override this at all. The web content will most likely fail WCAG Success Criterion 1.3.4 Orientation, unless the content qualifies for the "essential" exception (which is very rare).

If an android tablet is mounted in landscape orientation (e.g. on the arm of a wheelchair, or as part of a kiosk) then the user can't view the content unless they turn lean their head over by 90 degrees. If it's in a charging dock, you can lift the tablet up and turn it around. If it's in a kiosk or wheelchair mount, you don't have that option. If you have mobility impairments and can't lift a tablet, then you don't have the option of turning the device around.

It's not sufficient to omit the orientation options from the module's admin UI. It also needs to omitted from the manifest.json which is actually served.

The orientation key isn't merely a hint to user agents. It behaves as an outright lock.

Upshot: the mere act of enabling the module will result in a failure at WCAG level AA.

Based on the conversation in #3070058: Document how to specify the orientation parameter via alter hook β†’ , my understanding was that the API example for hook_pwa_manifest_alter() would explain how to add a new parameter. The manifest.json would only contain an orientation key if it had been explicitly added via this hook.

The D7 version of the module contains this API documentation for hook_pwa_manifest_alter():

  // Add a new parameter
  //
  // Here we are specifying `orientation`. If your website is designed to be
  // viewed ONLY in landscape, the `orientation` setting can help the PWA look
  // good while the splash/loading screens are displaying.

The orientation key isn't just about the loading screen. It restricts the PWA throughout it's entire usage.

Proposed resolution

This line from Manifest::getOutput() is the culprit:

  $manifest_data['orientation']  = 'portrait';

To address this, either use "any" as the hard-coded default here, or remove the line entirely. It isn't a mandatory key.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Closed: duplicate

Version

2.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom andrewmacpherson

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024