Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link control: Cancel and Save buttons visual order and DOM order mismatch #56039

Closed
afercia opened this issue Nov 10, 2023 · 0 comments · Fixed by #56042
Closed

Link control: Cancel and Save buttons visual order and DOM order mismatch #56039

afercia opened this issue Nov 10, 2023 · 0 comments · Fixed by #56042
Assignees
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Nov 10, 2023

Description

The link control UI provides two buttons: Cancel and Save.
These buttons visual order mismatches the DOM order. For accessibility, visual order and DOM order must always match.

There may be exceptions for decorative elements that don't impact meaning and operability but, in general, the usage of CSS properties that alter the visual order like all the flex / grid *-reverse and order properties should never be used.

Introeuced in #46933. Quoting the test instructions from that PR:

Specifically check that the tab order of the Link Control allows for Apply as the first tab stop (and thus the primary option) but also allows access to Cancel as the secondary stop.

It appears the altered order was intentional. However, this is an accessibility barriere and an explicit WCAG violation. It's important to make all designers and developers aware that visual order and DOM order must always match.

As far as I can tell, the link control is used in the link inline UI and also in the media replace flow UI. Screenshots:

before 01

before 02

Aside: notice the media replace popover has some extra, inconsistent, padding around the buttons.

Step-by-step reproduction instructions

  • Edit a post, select some text and add a link.
  • Select the link in the text. A popover opens. Click the pencil 'Edit' button.
  • A new UI opens within the popover, to edit the link.
  • Tab through the focusable elements.
  • Observe the Save button receives focus first, although it is placed on the right.
  • Observe the Cancel button receives focus second, althouhg it is placed on the left.
  • Add an Image block.
  • Select the image and click 'Replace' in the block toolbar.
  • Click the pencil 'Edit' button.
  • A new UI opens within the popover, to edit the image URL.
  • Tab through the focusable elements.
  • Observe the Save button receives focus first, although it is placed on the right.
  • Observe the Cancel button receives focus second, althouhg it is placed on the left.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@afercia afercia added [Type] Bug An existing feature does not function as intended [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) labels Nov 10, 2023
@github-actions github-actions bot added the [Status] In Progress Tracking issues with work in progress label Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Focus] Accessibility (a11y) Changes that impact accessibility and need corresponding review (e.g. markup changes). [Package] Block editor /packages/block-editor [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant