focus-visible icon indicating copy to clipboard operation
focus-visible copied to clipboard

Optionally scope focus-ring to a specific DOM node

Open YellowKirby opened this issue 8 years ago • 2 comments

For projects that are just standalone libraries/components, it might be beneficial to be able to scope the focus-ring JS to just a specific DOM node rather than the entire body. This would allow these components to use focus-ring without inadvertently modifying other parts of the parent application.

If the team thinks that this is worth doing, I'd be happy to submit a PR.

YellowKirby avatar Jul 17 '17 15:07 YellowKirby

I'd be interested in discussing how you'd like to implement this

robdodson avatar Nov 15 '17 23:11 robdodson

I would imagine it would be similar to jQuery's noConflict method. Existing behavior would stay the same: focus-ring automatically binds listeners to document and adds the class to any applicable element. However, when some API method is called (e.g., FocusRing.scope(node)) then any document-level behavior is removed and replaced with event listeners bound to the corresponding node (+ checking that any element that is about to receive the focus-ring class be a descendent of node before actually getting the class).

YellowKirby avatar Nov 16 '17 15:11 YellowKirby