question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[VisuallyHidden] Element imports CSS into JS, can this be handled in anothe way.

See original GitHub issue

❔ Question

When working with <VisuallyHidden/> the currently vended copy relies on importing CSS into JS:

import "./main.css";

My project doesn’t use CSS Modules and I’d like not to add additional complexity to my build tools. Is there an alternative to this techniques that could be used and support a broader number of project contexts?

The CSS is pretty small, might even fit into a Tweet ._u-react-spectrum-screenReaderOnly_3e916{border:0;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:0 -1px -1px 0;overflow:hidden;padding:0;position:absolute;width:1px;white-space:nowrap}._u-react-spectrum-screenReaderOnly_3e916._is-focusable_3e916:active,._u-react-spectrum-screenReaderOnly_3e916._is-focusable_3e916:focus{clip:auto;-webkit-clip-path:none;clip-path:none;height:auto;margin:inherit;overflow:visible;position:static;width:auto;white-space:inherit}, hopefully there are alternative approaches to including it.

🔦 Context

Attempting to use aria hooks in a low/no build environment.

🧢 Your Company/Team

Adobe Spectrum

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
devongovettcommented, Jul 28, 2020

Eh yeah, but we should solve this. Others might want to use React Aria in environments that don’t support CSS imports too.

0reactions
horaciohcommented, Aug 8, 2020

maybe this is related to this error. I made a codesandbox where is not possible to use visually-hidden or any package that uses it (like overlays) because of it: https://codesandbox.io/s/nextjs-react-aria-css-error-r33kz

any help I can do on testing or feedback let me know!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make DIV invisible in CSS and JavaScript
You can just use visibility:hidden if you want the element to be invisible but still rendered. display:none will remove it entirely and ...
Read more >
10 Ways to Hide Elements in CSS
An element can be visually hidden by positioning another over the top which has the same color as the background. In this example,...
Read more >
visibility - CSS: Cascading Style Sheets - MDN Web Docs
The visibility CSS property shows or hides an element without changing the layout of a document. The property can also hide rows or...
Read more >
Transitioning Hidden Elements
There are a ton of ways to hide HTML elements. You can use visibility, opacity, transforms, positioning, or even clip-paths.
Read more >
Places it's tempting to use `display: none;`, but don't
But things get a little tricker with JS libraries that apply their own CSS. For instance in jQuery, after you .slideUp() , you'll...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found