From f0bfd0bbd90a556a8ad4bccd9cb567462bf98e5b Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Sat, 17 Jun 2023 19:02:15 -0700 Subject: [PATCH] Add tabindex to Popover trigger --- components/common/Popover/index.tsx | 2 ++ components/raids/RaidCombobox/index.tsx | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/components/common/Popover/index.tsx b/components/common/Popover/index.tsx index f334b6a7..83265154 100644 --- a/components/common/Popover/index.tsx +++ b/components/common/Popover/index.tsx @@ -23,6 +23,7 @@ interface Props extends ComponentProps<'div'> { className?: string placeholder?: string } + triggerTabIndex?: number value?: { element: ReactNode rawValue: string @@ -83,6 +84,7 @@ const Popover = React.forwardRef(function Popover( {icon} {value} diff --git a/components/raids/RaidCombobox/index.tsx b/components/raids/RaidCombobox/index.tsx index 095bc249..62929160 100644 --- a/components/raids/RaidCombobox/index.tsx +++ b/components/raids/RaidCombobox/index.tsx @@ -18,6 +18,7 @@ interface Props { currentRaid?: Raid defaultRaid?: Raid minimal?: boolean + tabIndex?: number onChange?: (raid?: Raid) => void onBlur?: (event: React.ChangeEvent) => void } @@ -114,7 +115,6 @@ const RaidCombobox = (props: Props) => { // Set current raid and section when the current raid changes useEffect(() => { if (props.currentRaid) { - console.log('We are here with a raid') setCurrentRaid(props.currentRaid) setCurrentSection(props.currentRaid.group.section) } @@ -183,7 +183,6 @@ const RaidCombobox = (props: Props) => { const { top: itemTop } = node.getBoundingClientRect() listRef.current.scrollTop = itemTop - listTop - console.log('Focusing node') node.focus() setScrolled(true) } @@ -534,6 +533,7 @@ const RaidCombobox = (props: Props) => { onOpenChange={toggleOpen} placeholder={t('raids.placeholder')} trigger={{ className: 'Raid' }} + triggerTabIndex={props.tabIndex} value={renderTriggerContent()} >