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

♿️(styles) improve the offscreen class #1645

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

manuhabitela
Copy link
Collaborator

@manuhabitela manuhabitela commented Mar 22, 2022

Change the implementation of the offscreen class to match the one from bootstrap that is battle-tested.

The main idea is to stop using left: -100000px that can cause scrolling "flicker" or weird focus styles when using a screen reader, as that can be annoying for sighted people that use a screen reader.

@manuhabitela manuhabitela self-assigned this Mar 22, 2022
@manuhabitela manuhabitela added the a11y Accessibility related tasks label Mar 22, 2022
Comment on lines 9 to 17
position: absolute !important;
width: 1px !important;
height: 1px !important;
padding: 0 !important;
margin: -1px !important;
overflow: hidden !important;
clip: rect(0, 0, 0, 0) !important;
white-space: nowrap !important;
border: 0 !important;
Copy link
Member

Choose a reason for hiding this comment

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

https://css-tricks.com/comparing-various-ways-to-hide-things-in-css/#aa-method-5-the-visually-hidden-class

From this article, I think you should add clip-rect below clip as this last one has been deprecated in favor of the first.

Furthermore, I think you should remove !important

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm with @jbpenrath on the !important part. It makes things more complex to debug if we ever override something in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You meant clip-path I guess. There were a few discussions on this in the bootstrap project, and not using it is intentional, even when knowing it's deprecated, i'll let you check twbs/bootstrap#25197

Copy link
Collaborator Author

@manuhabitela manuhabitela Mar 22, 2022

Choose a reason for hiding this comment

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

Will remove the !important bits ;).
edit: done.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So what do you think @jbpenrath about the clip-path issue? Seems to have noticeable perfs issues because of a Chrome bug. My choice would be to leave it as is, but as you wish, let me know.

Copy link
Member

@jbpenrath jbpenrath Mar 24, 2022

Choose a reason for hiding this comment

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

I didn't know about that. Since february 2018, the problem seems to be fixed. I tried an example from my chromium based browser and there is no more painting issue. https://bugs.chromium.org/p/chromium/issues/detail?id=611257
So I think we could use it today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good find, updated 👍

src/frontend/scss/generic/_accessibility.scss Show resolved Hide resolved
Change the implementation of the offscreen class to match the one from
bootstrap that is battle-tested.

The main idea is to stop using "left: -100000px" that can cause
scrolling "flicker" or weird focus styles when using a screen reader.
This can be annoying for sighted people that use a screen reader.
@manuhabitela manuhabitela merged commit 917c9fb into openfun:master Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a11y Accessibility related tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants