Skip to content

Conversation

devongovett
Copy link
Member

Fixes #861.

This removes the CSS import from @react-aria/visually-hidden and uses inline styles instead. Unfortunately, due to the isFocusable prop, we have to also add dependencies on @react-aria/interactions for useFocus and @react-aria/utils for mergeProps because you cannot have a :focus selector on an inline style. We don't currently use the isFocusable prop anywhere, but in order to maintain semver compatibility we cannot drop it. Luckily, in most cases, these functions will already be dependencies of anything that uses VisuallyHidden. We can look at dropping the isFocusable prop in the next major though.

@adobe-bot
Copy link

Build successful! 🎉

className
);
let [isFocused, setFocused] = useState(false);
let {focusProps} = useFocus({
Copy link
Member

Choose a reason for hiding this comment

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

should useFocus return isFocused as well, like the useHover hook?

Copy link
Member Author

Choose a reason for hiding this comment

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

ehh maybe a separate task. Not sure whether we want to add state to every call to useFocus though

@adobe-bot
Copy link

Build successful! 🎉

@dannify dannify merged commit e191454 into main Aug 11, 2020
@dannify dannify deleted the visually-hidden-css branch August 11, 2020 01:54
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.

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