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

Refactor #1

Merged
merged 13 commits into from
Oct 25, 2022
Merged

Refactor #1

merged 13 commits into from
Oct 25, 2022

Conversation

anilanar
Copy link
Member

@anilanar anilanar commented Feb 27, 2022

Refactors the original impl to do the following changes:

  1. Converts polyfill to ponyfill. No more global side effects at module load. Exports enablePonyfill function.
  2. enablePonyfill returns a cleanup function that undoes ponyfilling (WIP).
  3. Converts to typescript. Improves some checks that is used for converting EventTarget -> Node -> Element -> HTMLElement using instance checks.
  4. Improves scoping so that it works in iframes. Infers window/document from the passed scope instead of using the global window/document, which simply doesn't work for iframes.
  5. Removes test infra (perhaps temporarily) which was source of many audit errors.
  6. Released as @userlike/focus-visible.

Copy link

@buscape buscape left a comment

Choose a reason for hiding this comment

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

lgtm in general, the only improvement we can think about is just using either focus-visible class or the data-focus-visible-added data attribute instead of both of them.

@anilanar
Copy link
Member Author

@buscape I don't want to change what the original library does because chakra-ui relies on them and may rely on them in a different way in future.

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.

2 participants