-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add portal
prop to Combobox
, Listbox
, Menu
and Popover
components
#3124
Commits on Apr 23, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 87be4dd - Browse repository at this point
Copy the full SHA 87be4ddView commit details -
accept
enabled
prop onPortal
componentThis way we can always use `<Portal>`, but enable / disable it conditionally.
Configuration menu - View commit details
-
Copy full SHA for 8957321 - Browse repository at this point
Copy the full SHA 8957321View commit details -
This allows us to _not_ provide the ref is no ref was passed in.
Configuration menu - View commit details
-
Copy full SHA for 4a51768 - Browse repository at this point
Copy the full SHA 4a51768View commit details -
refactor inner workings of
useInert
moved logic from the `useEffect`, to module scope. We will re-use this logic in a future commit.
Configuration menu - View commit details
-
Copy full SHA for 31c1098 - Browse repository at this point
Copy the full SHA 31c1098View commit details -
Mark all elements on the page as inert, except for the ones that are allowed. We move up the tree from the allowed elements, and mark all their siblings as `inert`. If any of the children happens to be a parent of one of the elements, then that child will not be marked as `inert`. ``` <body> <!-- Stop at body --> <header></header> <!-- Inert, sibling of parent of allowed element --> <main> <!-- Not inert, parent of allowed element --> <div>Sidebar</div> <!-- Inert, sibling of parent of allowed element --> <div> <!-- Not inert, parent of allowed element --> <Listbox> <!-- Not inert, parent of allowed element --> <ListboxButton></ListboxButton> <!-- Not inert, allowed element --> <ListboxOptions></ListboxOptions> <!-- Not inert, allowed element --> </Listbox> </div> </main> <footer></footer> <!-- Inert, sibling of parent of allowed element --> </body> ```
Configuration menu - View commit details
-
Copy full SHA for dec0d7a - Browse repository at this point
Copy the full SHA dec0d7aView commit details -
add
portal
prop, and change meaning ofmodal
prop onMenuItems
- This adds a `portal` prop that renders the `MenuItems` in a portal. Defaults to `false`. - If you pass an `anchor` prop, the `portal` prop will always be set to `true`. - The `modal` prop enables the following behavior: - Scroll locking is enabled when the `modal` prop is passed and the `Menu` is open. - Other elements but the `Menu` are marked as `inert`.
Configuration menu - View commit details
-
Copy full SHA for 9bc11fc - Browse repository at this point
Copy the full SHA 9bc11fcView commit details -
add
portal
prop, and change meaning ofmodal
prop on `ListboxOpti……ons` - This adds a `portal` prop that renders the `ListboxOptions` in a portal. Defaults to `false`. - If you pass an `anchor` prop, the `portal` prop will always be set to `true`. - The `modal` prop enables the following behavior: - Scroll locking is enabled when the `modal` prop is passed and the `Listbox` is open. - Other elements but the `Listbox` are marked as `inert`.
Configuration menu - View commit details
-
Copy full SHA for 85274b6 - Browse repository at this point
Copy the full SHA 85274b6View commit details -
add
portal
andmodal
prop onComboboxOptions
- This adds a `portal` prop that renders the `ComboboxOptions` in a portal. Defaults to `false`. - If you pass an `anchor` prop, the `portal` prop will always be set to `true`. - The `modal` prop enables the following behavior: - Scroll locking is enabled when the `modal` prop is passed and the `Combobox` is open. - Other elements but the `Combobox` are marked as `inert`.
Configuration menu - View commit details
-
Copy full SHA for 6561718 - Browse repository at this point
Copy the full SHA 6561718View commit details -
add
portal
prop, and change meaning ofmodal
prop onPopoverPanel
- This adds a `portal` prop that renders the `PopoverPanel` in a portal. Defaults to `false`. - If you pass an `anchor` prop, the `portal` prop will always be set to `true`. - The `modal` prop enables the following behavior: - Scroll locking is enabled when the `modal` prop is passed and the `Panel` is open.
Configuration menu - View commit details
-
Copy full SHA for 3510922 - Browse repository at this point
Copy the full SHA 3510922View commit details -
Configuration menu - View commit details
-
Copy full SHA for 92dbcd9 - Browse repository at this point
Copy the full SHA 92dbcd9View commit details -
remove internal
Modal
componentThis is now implemented on a per component basis with some hooks.
Configuration menu - View commit details
-
Copy full SHA for 9d02180 - Browse repository at this point
Copy the full SHA 9d02180View commit details -
remove
Modal
handling fromDialog
The `Modal` component is removed, so there is no need to handle this in the `Dialog`. It's also safe to remove because the components with "portals" that are rendered inside the `Dialog` are portalled into the `Dialog` and not as a sibling of the `Dialog`.
Configuration menu - View commit details
-
Copy full SHA for a5e2f06 - Browse repository at this point
Copy the full SHA a5e2f06View commit details -
ensure we use
groupTarget
if it is already availableBefore this, we were waiting for a "next render" to mount the portal if it was used inside a specific group. This happens when using `<Portal/>` inside of a `<Dialog/>`.
Configuration menu - View commit details
-
Copy full SHA for 6ef8117 - Browse repository at this point
Copy the full SHA 6ef8117View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6b3b62f - Browse repository at this point
Copy the full SHA 6b3b62fView commit details -
Configuration menu - View commit details
-
Copy full SHA for d7c5396 - Browse repository at this point
Copy the full SHA d7c5396View commit details
Commits on Apr 24, 2024
-
ensure we stop before the
body
We used to have a `useInertOthers` hook, but it also made everything inside `document.body` inert. This means that third party packages or browser extensions that inject something in the `document.body` were also marked as `inert`. This is something we don't want. We fixed that previously by introducing a simpler `useInert` where we explicitly marked certain elements as inert: #2290 But I believe this new implementation is better, especially with this commit where we stop once we hit `document.body`. This means that we will never mark `body > *` elements as `inert`.
Configuration menu - View commit details
-
Copy full SHA for 4fdef30 - Browse repository at this point
Copy the full SHA 4fdef30View commit details -
add
allowed
anddisallowed
touseInertOthers
This way we have a list of allowed and disallowed containers. The `disallowed` elements will be marked as inert as-is. The allowed elements will not be marked as `inert`, but it will mark its children as inert. Then goes op the parent tree and repeats the process.
Configuration menu - View commit details
-
Copy full SHA for 3a212ca - Browse repository at this point
Copy the full SHA 3a212caView commit details -
Configuration menu - View commit details
-
Copy full SHA for e046550 - Browse repository at this point
Copy the full SHA e046550View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6c15c99 - Browse repository at this point
Copy the full SHA 6c15c99View commit details -
Configuration menu - View commit details
-
Copy full SHA for c8d9611 - Browse repository at this point
Copy the full SHA c8d9611View commit details -
Configuration menu - View commit details
-
Copy full SHA for b8931b2 - Browse repository at this point
Copy the full SHA b8931b2View commit details -
Configuration menu - View commit details
-
Copy full SHA for bf7497e - Browse repository at this point
Copy the full SHA bf7497eView commit details