Repository navigation
Conversation
commit: |
Bundle size
PerformanceTotal duration: 1,150.04 ms -1.81 ms(-0.2%) | Renders: 78 (+0)
12 tests within noise — details Metric alarms
Check out the code infra dashboard for more information about this PR. |
✅ Deploy Preview for base-ui ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
@kylemcd can you share some screenshots/wireframes of what you're trying to build to better understand the motivation? If I understood correctly, you are using an input as a Menu trigger, but I want to understand why you didn't reach for Autocomplete in this case. |
|
I just noticed https://telegraph-storybook-git-kyle-kno-14086-telegra-21a570-knocklabs.vercel.app/?path=/story/components-menu--typeable-trigger from knocklabs/telegraph#869. Although I not have the necessary context, looking at that Storybook link it looks like Autocomplete might be what you're looking for.
|
|
yeah here's some context, but feel free to close this if there isn't utility in it for anyone else. we recently completed a radix to base ui migration for our component library telegraph. within telegraph we have the menu component which under the hood used radix's internal menu API so that we could get the keyboard / focus management a11y for free. within the knock dashboard, we have this super complex variable selector component that utilized the radix menu to get some of the keyboard management for free (see screenshot). this component does a lot of heavy lifting across our dashboard and refactoring that carries a ton of risk we're not wanting to take on right now. (eventually though you're right, we should migrate to the base ui autocomplete component)
the base-ui menu fit the bill perfectly besides not being able to manage the initial focus. in the popover and dialog components, there's the because the base ui menu component doesn't allow for setting this prop in the same way dialog and popover does, we have to write this gross code in order to manage the focus in a way that doesn't break the variable selector code for example, see code: https://github.com/knocklabs/telegraph/pull/869/changes#diff-68ffc570fefcc972b7f997962aae62f5d4fc8be21fa7522ebb47128900d48dd8 so the ask is just to have parity between these. (there's already access to the |
|
From what you describe, it looks like you're after Autocomplete (or Combobox, depending on the exact UX). The problem with the pattern you're using (Menu with typeable trigger) is that it breaks the WAI-ARIA pattern: the trigger is supposed to be a button, and the focus always moves focus to the first or last menu item (see https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/#keyboardinteraction). Since the focus must always be moved to a menu item, there wasn't a use case for In short, it's unlikely we merge this since there's no use case for |
|
Thanks for the PR @kylemcd, but we won't go ahead with it as we don't think there's a good use case for |
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
|
Thanks for the guidance here. We've now moved this typeable-trigger use case to a Combobox/Autocomplete-based implementation in Telegraph and deprecated the Menu-based recipe, so this can stay closed. I'll remove the fork branch as well. |
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo.
…nce (KNO-14119) (#917) * docs(menu): deprecate the typeable-trigger recipe, keep the focus-bounce (KNO-14119) Reframe the typeable-input-inside-`Menu.Trigger` composition as a deprecated legacy recipe across the menu package, pointing new UI at `@telegraph/combobox`'s input-as-trigger arrangement. No runtime change — the focus-bounce that keeps focus in place when a consumer prevents `onOpenAutoFocus` is retained byte-for- byte as permanent Radix-compat behavior. - Story: rename to "Typeable Trigger (deprecated)" and rewrite its doc comment as a deprecation notice linking the combobox input-as-trigger story. - Fixture / test / browser-test: keep as focus-bounce regression coverage, reframe the JSDoc and describe names to the behavior under test (Radix-compat prevented-onOpenAutoFocus), keeping the KNO-14086 repro context. - `Menu.tsx`: rewrite the bounce comment to describe permanent Radix-compat behavior instead of a shim pending an upstream `initialFocus` opt-out. - Add a patch changeset. Upstream housekeeping (close mui/base-ui#5189, delete the fork branch) is done separately outside the repo. * docs(menu): link deprecated trigger alternative * fix(menu): support buttons outside menu roots * docs(menu): mark rootless button fallback transitional * refactor(menu): keep render props as data


Menu.Popuphardcodes initial focus on its focus manager, so there's no way to stop the popup grabbing focus on open.Popover.PopupandDialog.Popupalready exposeinitialFocusfor exactly this — this adds the same prop toMenu.Popup.motivation: a trigger that renders a typeable input (combobox-style) can't keep focus when the menu opens, since the popup always pulls focus inside.
initialFocus={false}lets the consumer opt out.initialFocustoFloatingFocusManager, same type/JSDoc asPopover/Dialogundefinedstill resolves toparent.type !== 'menu', so it's a no-op unless setcreateDefaultInitialFocuslike popover/dialog — that adds touch/virtual-keyboard handling menus don't have today, which would change behaviortypes.mdtables (menu + context-menu)test plan
pnpm test:jsdomonMenuPopup.test.tsx— 23 pass, incl. two new cases: default focuses the first item, andinitialFocus={false}keeps focus on the trigger