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

Visually hiding content and the clip-path pattern #322

Open
renestalder opened this issue Mar 12, 2021 · 2 comments
Open

Visually hiding content and the clip-path pattern #322

renestalder opened this issue Mar 12, 2021 · 2 comments

Comments

@renestalder
Copy link
Collaborator

The current pattern to visually hide content we have in the guide moves elements outside the viewport (by assuming the viewport isn't bigger than the statically defined pixel size).

The two issues often mentioned with that patterns are:

  • It might create issues with right to left languages.
  • Probably rare, but it doesn't react to technological changes, e.g. bigger screen sizes.

The alternative pattern I often see recommended is the clip-path pattern:

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

or with a focus handler:

.visually-hidden:not(:focus):not(:active) {
  /* ... */
}

Does it make sense to leave the positioning pattern in the guide when other resources recommend the clip-path pattern? Should we probably apply the same pattern?

@backflip
Copy link
Collaborator

Related: #234

@jmuheim
Copy link
Collaborator

jmuheim commented Feb 1, 2023

I'm using this for over a year now, and it seems to work nicely:

https://css-tricks.com/inclusively-hidden/

@backflip backflip moved this from Needs triaging to Needs to be discussed in Overall Issue Dashboard May 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: future activities
Development

No branches or pull requests

3 participants