Repository navigation
fix(Label, Drawer): add ref forwarding - #12688
Closed
tarunvashishth wants to merge 3 commits into
Closed
tarunvashishth wants to merge 3 commits into
tarunvashishth wants to merge 3 commits into
Conversation
Wrap Label in forwardRef so that refs passed to the component are attached to its root element (span, or button for overflow/add variants). Closes patternfly#12651
Wrap Drawer, DrawerActions, DrawerCloseButton, DrawerContent, DrawerContentBody, DrawerHead, DrawerMain, DrawerPanelBody, DrawerPanelContent, DrawerPanelDescription and DrawerSection in forwardRef. Components that already hold an internal ref to their root element (Drawer, DrawerContent, DrawerPanelContent) expose it through useImperativeHandle so internal behavior such as resizing keeps working. Closes patternfly#12650
…l-mkz78g # Conflicts: # packages/react-core/src/components/Drawer/Drawer.tsx # packages/react-core/src/components/Drawer/DrawerCloseButton.tsx # packages/react-core/src/components/Drawer/DrawerSection.tsx # packages/react-core/src/components/Drawer/__tests__/Drawer.test.tsx
|
Caution Review failedThe pull request is closed. Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Collaborator
|
Preview: https://pf-react-pr-12688.surge.sh A11y report: https://pf-react-pr-12688-a11y.surge.sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What: Closes #12651, closes #12650
Adds ref forwarding to
Labeland to all Drawer components, following the existingforwardRef+innerRefpattern used by components such asPanelandCard.<span>, or<button>for theoverflowandaddvariants).Drawer,DrawerActions,DrawerCloseButton,DrawerContent,DrawerContentBody,DrawerHead,DrawerMain,DrawerPanelBody,DrawerPanelContent,DrawerPanelDescriptionandDrawerSectionnow forward refs to their root<div>.Drawer,DrawerContentandDrawerPanelContentalready keep an internal ref to that element (used for resizing). They expose it withuseImperativeHandleinstead of replacing it, so resizing keeps working. ForDrawerContentthe ref points at thepf-v6-c-drawer__contentdiv, the element that receives the spread props.Testing
jestfor Drawer, Label, react-table and react-templates: all passing.Additional issues: None