[react-aria-components] Weird behavior on NumberField buttons
#6980
Unanswered
Manuel-Manoury
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Maybe the 'slot' prop isn't making it through? Otherwise, issues with context being lost are commonly indicative of multiple copies of our packages or accidentally loading two different types of modules from our packages, cjs + mjs or something along those lines. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi 👋
I'm using
react-aria-componentsas a base on which I develop my company's design system, and I'm currently scratching my head while usingNumberField.Everything works fine if I follow the documented usage, i.e. if I use
Buttonfromreact-aria-componentdirectly as a children ofNumberField.However, I have implemented a custom
Buttonas a part of my design system (based onButtonfromreact-aria-component), which is fairly simple :However, when I use this button, I lose some "automatic behavior" (such as setting the relevant button as disabled when the field value is equal to
minValue/maxValue🤔As a result, I tried to create an intermediate component to rely on
useContext(NumberFieldStateContext);to flag my buttons as disabled when needed, but by doing so I lose another "automatic behavior", namely the binding of theonPresshandlers. They are available through the context mentioned before so it's ok, but I don't understand why those behavior can get "lost" depending on the fact that I add an abstraction layer or not 🤔I tried removing the abstraction (my custom button as a direct child of
NumberField) and addingforwardRefanduseContextProps(props, ref, ButtonContext)along withuseButton(props, ref)to myButtonabstraction, without changes.I feel like I'm missing something to understand how this work, can you help me figure out what I'm missing here ? Thanks 🙏
Beta Was this translation helpful? Give feedback.
All reactions