Skip to content

fix(global): positioned sr-only class to top/left 0 to avoid overflow - #3319

Merged
mcoker merged 1 commit into
patternfly:masterfrom
mcoker:issue-3318
Jul 24, 2020
Merged

mcoker merged 1 commit into
patternfly:masterfrom
mcoker:issue-3318

Conversation

@mcoker

@mcoker mcoker commented Jul 23, 2020

Copy link
Copy Markdown
Contributor

fixes #3318

This fixes a problem found in the notification drawer. One option to fix that is to just apply this change in the notification drawer. That said, a lot of the sr-only classes use positioning like top: -9999px; left: -9999px; or some variant of that, so it doesn't seem like the positioning plays a role in how the content is read. https://webaim.org/techniques/css/invisiblecontent/

This will simply contain the element within the bounding box of its closest ancestor with a coordinate system instead of placing it wherever it is in the document flow, which triggers this bug in chrome.

@patternfly-build

patternfly-build commented Jul 23, 2020 •

Copy link
Copy Markdown
Collaborator

Preview: https://patternfly-pr-3319.surge.sh

CSS Size Report
NameCurrentPreviousDiff %
base/patternfly-common.css318 B297 B6.60
utilities/Accessibility/accessibility.css2.7 kB2.6 kB5.35
patternfly-addons.css147.9 kB147.7 kB0.10
patternfly-base.css106.1 kB106.0 kB0.02
patternfly-no-reset.css742.4 kB742.3 kB0.00
patternfly.css744.3 kB744.2 kB0.00
patternfly.min.css655.6 kB655.6 kB0.00

A11y report: https://patternfly-pr-3319-coverage.surge.sh

@mattnolting mattnolting left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

@christiemolloy christiemolloy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@jessiehuff jessiehuff left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting find @mcoker!! 🙂

So the only thing we should keep in mind when positioning elements when it comes to screen readers is that screen readers typically follow the order of the DOM/HTML structure when reading a document. When CSS is used to position content, the content that appears on the screen could potentially appear to be in a different order from what appears in the code. So for example, if you positioned text to be in the top left, but that div is the last element in the HTML structure, that would be very confusing for screen reader users. Here's an article that explains it further.

However, in this case, I don't see it affecting the order. It seems that we're just positioning the text to its container so I don't imagine it'd have an effect on screen reader users. I also don't mind this being a general fix because if it was having unexpected side effects with notification drawer, I could see it having unexpected side effects down the road with something else.
LGTM! 😄

@mcoker
mcoker merged commit f54a1d1 into patternfly:master Jul 24, 2020
@jessiehuff jessiehuff added the A11y Accessibility related issues label Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants