-
Notifications
You must be signed in to change notification settings - Fork 85
feat: introduce support for react v18 (FE-6015) #7148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
19621c9 to
7d2f7d1
Compare
eaa07b1 to
26d2ea3
Compare
26d2ea3 to
108266e
Compare
| } | ||
| }; | ||
| document.addEventListener("mousedown", handleClick); | ||
| const handleClickAway = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: glad to see this has been resolved without the cludge being necessary anymore!
src/components/accordion/accordion-group/accordion-group.component.tsx
Outdated
Show resolved
Hide resolved
src/components/action-popover/action-popover-menu/action-popover-menu.component.tsx
Outdated
Show resolved
Hide resolved
src/components/anchor-navigation/anchor-navigation.component.tsx
Outdated
Show resolved
Hide resolved
src/components/duelling-picklist/picklist-group/picklist-group.component.tsx
Outdated
Show resolved
Hide resolved
| HTMLAnchorElement & HTMLButtonElement & HTMLDivElement, | ||
| SubmenuProps | ||
| >( | ||
| const Submenu = React.forwardRef<HTMLAnchorElement, SubmenuProps>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is this type correct? As we can still pass an onClick to the parent item and that will cause it to use polymorphism to render a button
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it doesn't matter to TS at compile time though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to typing in styled-components, StyledMenuItemWrapper is inferred as a anchor element by default. Setting the ref type to HTMLAnchorElement | HTMLButtonElement results in type errors. It seems TypeScript cannot infer the ref could be of a different element type when the polymorphic as prop is passed. There may be technical detail I'm overlooking as to why its being inferred like this.
I also tried the following:
// menu-item.style.ts
const StyledMenuItemWrapper = styled(Link)<StyledMenuItemWrapperProps>`
/* css */
`;but this caused further type errors due incorrect props being passed to Link. So I've opted for this as a workaround until we revisit our abstractions around Link.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No worries, it makes sense thanks for clearing it up
|
I got on a call with @Parsium. Portals aren't opening when using |
|
Also, as a side note: other than portals + |
38b63ea to
87166ec
Compare
in preparation for consuming latest version of React Testing Library and its sibling packages
BREAKING CHANGE: Both packages are now ESM-only, which may affect tools like Jest that run your project code in a Node.js environment. Adjust your bundler configuration to handle ESM code if issues arise.
…ble items A `MenuItem` is now only focusable when tabbing if it has an `href`, `onClick`, or `submenu` prop, or contains a focusable child.
BREAKING CHANGE: Temporary incompatibility with React Strict Mode. In React v18, Strict Mode now intentionally re-renders components and re-executes their effects and callbacks an extra time. This leads to unintended side effects in several Carbon components. A fix will be provided in advance of introducing React v19 support. If you encounter issues, you can either disable Strict Mode globally, or apply it selectively to specific parts of your application.
…h about focus changes
…cy of onListScrollBottom calls
…Home/End key presses
…ng focusable content
…p, Down, Home and End keys A `MenuItem` is now only focusable via Up, Down, Home and End key navigation if it has an `href`, `onClick`, or `submenu` prop, or contains a focusable child.
87166ec to
db8f54c
Compare
|
🎉 This PR is included in version 148.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
addresses #6517
Proposed behaviour
react-dndandreact-dnd-html5-backendare now ESM-only packages.Features
react-dndandreact-dnd-html5-backendto version ^16.0.0@tanstack/react-virtualdependency to version ^3.11.2Portrait- Adddata-elementanddata-roleprops for testing purposesMenu- let browser handle tabbing to prevent focus on non-focusable itemsMenu- skip non-focusable submenu items when moving focus with Up, Down, Home and End keysMenu- prevent showing hover styling for non-focusable menu itemsFixes
Menu- ensure focus state remains consistent between tabbing and Home/End key pressesMenu- prevent root element from being focused when containing focusable contentSelect- debounce scroll handler on option list to reduce frequency of onListScrollBottom callsCurrent behaviour
Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions
Using the Storybook build, verify that the following remain unchanged for all Carbon components:
Compare these attributes against the latest production build of Storybook, using the latest versions of Chrome, Safari and Firefox.
Exceptions
The following stories have been updated in the PR and are expected to show changes. These should not be flagged for regressions:
Dialog: "Editable" story (removed)RadioButton: "With Legends and Labels" story (small change to component usage)Menu: "Menu Full Screen with Max Width" (changes to number of menu items)