Comments (2)
This is because useFocus
doesn't add focusout
listeners to the floating element itself, and only listens for the reference blurring, which doesn't happen in this scenario.
FloatingFocusManager
however does with non-modal focus management:
<FloatingFocusManager context={context} modal={false} initialFocus={-1}>
{/* floating element */}
</FloatingFocusManager>
In general, it's better to use the focus manager for this because it also handles portaled floating elements which the above Sandbox doesn't (if there were to be focusable elements between the reference and floating element in the DOM tree)
from floating-ui.
@atomiks Gotcha, thanks for clarifying! That fork does what I need.
I think it might be helpful to mention FloatingFocusManager
in the docs for useFocus
to clarify that it's more suitable in situations where the floating element is focusable. We can close this issue, though.
from floating-ui.
Related Issues (20)
- Position issue when scroller is inside another scroller HOT 8
- Combine flip and shift middleware doesn't keep original placement HOT 9
- npm ERR! notarget No matching version found for @floating-ui/dom@^1.6.0. HOT 3
- `useHover` without safePolygon is missing `mouseEnter` / `mouseLeave` HOT 2
- Virtual element sometimes leaves the wrapper element specified HOT 2
- Placement of popper is not working correctly HOT 3
- After upgrade to latest, floating-ui portal gets id=undefined HOT 10
- [DOM] `popover` attribute collision detection fails with `absolute` strategy HOT 1
- Need help to make ui like this HOT 2
- Shift middleware with a boundary doesn't respect bondary bottom edge HOT 10
- exceeding the boundary HOT 1
- Detect `event.target.matches(':hover')` in `useFocus onBlur` handler HOT 2
- when return value of the `getElementRects` is a DOMRect, only the `x` , `y` fields exist in rect in `convertOffsetParent34` method
- computePosition is not returning position properly for SVG Element inside <mask> for FireFox HOT 1
- When 'overflow: scroll' is applied to handle long floating content, the arrow is hidden too HOT 4
- Better support for using with `exactOptionalPropertyTypes` enabled HOT 2
- Herr
- Floating element flickers / flips continuously on overflow due to appearing scrollbars HOT 1
- Axe violations when using FloatingPortal and FloatingFocusManager HOT 1
- arrow middleware break other middleware HOT 1
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 floating-ui.