[internal] Add DirectionProvider#931
Conversation
Netlify deploy preview |
01a19b9 to
451ba9c
Compare
451ba9c to
3315837
Compare
31806df to
7115bd1
Compare
7115bd1 to
e9e5589
Compare
1a0016f to
f05d2fa
Compare
a81268b to
45d6b6c
Compare
45d6b6c to
ed92993
Compare
| const directionContext = useDirectionContext(); | ||
| const direction = directionContext?.direction ?? 'ltr'; |
There was a problem hiding this comment.
Since it only has one value, we could simplify this by defaulting ltr inside useDirectionContext() and returning the value directly, const direction = useDirectionContext()
atomiks
left a comment
There was a problem hiding this comment.
ScrollArea also checks for RTL. Should we default to checking for computed styles if it's cheap, like inside an event, and falling back to the provider otherwise?
Floating elements force read the style and would ignore the provider, unless we add it here: https://floating-ui.com/docs/platform#isrtl
I thought about this, but we have to document DirectionProvider as a required step when changing the behavior is involved anyway to maintain that "there is one single way to set up RTL", even though technically it's not necessary (e.g. for ToggleGroup/RadioGroup) And if a component doesn't actually use the provider internally it would obscure issues when someone used the provider but forgot to set |
ed92993 to
e4571cc
Compare
@atomiks I think this should be fine for our components since only For the rest (popover, preview card etc), they should first use logical I suppose since |
Closes #831
Closes #59
Docs: https://deploy-preview-931--base-ui.netlify.app/components/react-direction-provider
Updates Menu, RadioGroup, Slider, Tabs, Accordion, ToggleGroup
I have followed (at least) the PR section of the contributing guide.