Comments (7)
I'm not sure I understand the issue :)
Are you saying that the polyfill is applying focus-ring when you click on a link or button with a mouse? Can you provide a reproducible test case that demonstrates the problem?
from focus-visible.
The polyfill is only applying the style to input / editable fields and only if you use key press like tab to get there.
However, according to documentation it should apply focus-ring always to editable content, even in case of mouse click.
The polyfill doesn't apply focus ring in case of mouse clicks here but it should.
On the other hand, it should instead apply focus-ring to all other elements on focus only when using key press and not mouse clicks. However, the polyfill doesn't apply focus-ring to any other elements at all currently.
See:
https://github.com/WICG/focus-ring/blob/master/src/focus-ring.js#L97
and
https://github.com/WICG/focus-ring/blob/master/src/focus-ring.js#L30
It therefore only adds the focus-ring class to editable content and only in case of a keypress.
Also check example 34 of the linked documentation
For example, UAs typically display focus indicators on text elements whenever they’re focused, to draw attention to the fact that keyboard input will affect their contents.
On the other hand, they typically only display focus indicators on buttons when they were focused by a keyboard interaction (such as tabbing through the document), because it’s not always immediately obvious where the focus will move after such an interaction, but not when they were focused by more "obvious" interactions, like clicking on the button with a mouse pointer.
I could, of course, be wrong with the defintion of focus-ring but not according to the example but maybe that is just a misinterpretation on my part?
from focus-visible.
OK thanks I'll look into this. There were some recent changes which seemed to have broken some things. I'm working on a new selenium test runner to better catch these issues.
from focus-visible.
OK. I just checked the latest version again and it seems to work correctly now. Maybe I was testing a buggy version before?
from focus-visible.
Ah sorry, it was working with 2.0.2 but not with master there it is broken
from focus-visible.
ok good to know :)
from focus-visible.
See also this jsfiddles:
broken: https://jsfiddle.net/yayrqksu/3/ (copied master dist into script)
working: https://jsfiddle.net/yayrqksu/2/ (copied 2.0.2 dist into script)
One small issue I noticed with v2.0.2 if you tab through both fields and then do another tab to go outside the textfield and then click on the button, the button still receives the focus-ring class but otherwise v2.0.2 seems to work correctly.
from focus-visible.
Related Issues (20)
- Don't enable polyfill if browser supports ":focus-visible" HOT 5
- List a `module` export in package.json` HOT 3
- .focus-visible skips elements on Safari HOT 4
- How to add declaration when importing as module in Rollup + Typescript? HOT 3
- Conditional Application? HOT 1
- Focus visible... but for aria-activedescendant? HOT 1
- Managed Focus in Safari
- Keyboard escape hides focus on Button ContextMenu HOT 3
- Always applies focus-visible to inputs in React even when click HOT 3
- Add hint to documentation about ES6 import
- [performance] applying the polyfill in self contained web components with light dom HOT 1
- :focus-visible's "hidden focus" artifact can result in user UI confusion on Mac HOT 13
- Default to polyfill off in Web Native cases?
- Warning when building HOT 2
- Applying :focus-visible state after programmatically moving focus only on initial page landing
- `:focus-visible` should match when focus is programmatically moved to inside a dialog HOT 3
- Memory leaks when applyFocusVisiblePolyfill is applied then the element is removed HOT 3
- Remove source map for minified build in releases
- Readme/polyfill HOT 1
- [Bug] focusVisible status is not added correctly when user interacts with keyboard and mouse
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from focus-visible.