Skip to content

Commit e4abd3f

Browse files
committed
revert(emcn-docs): drop the post-freeze tabIndex props from the staging merge
The c037660 merge ported #9827's tabIndex options into the frozen CodeContent, ScrollRegion and Tab. Restored to their pre-merge source. The docs sample keeps one keyboard entry at the call site: its panel leaves the tab order and the code region takes focus when it overflows.
1 parent b818ddf commit e4abd3f

4 files changed

Lines changed: 7 additions & 22 deletions

File tree

‎apps/docs/components/docs/sample-panels/sample-panels.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,12 @@ export function SamplePanels({
8686
value={item.value}
8787
label={item.label}
8888
id={item.id ?? `${selectorId}-${item.value}`}
89+
// One keyboard entry per sample: the code region, which takes focus when it overflows.
8990
tabIndex={-1}
9091
{...(presentation === 'select' ? { role: 'region', 'aria-labelledby': selectorId } : {})}
9192
className='[&>div]:pt-0'
9293
>
93-
<CodeContent label={`${label}: ${item.label}`} tabIndex={0}>
94-
{item.panel}
95-
</CodeContent>
94+
<CodeContent label={`${label}: ${item.label}`}>{item.panel}</CodeContent>
9695
</Tab>
9796
))}
9897
</Tabs>

‎packages/emcn-docs/src/components/code-block/code-block.tsx‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,13 @@ interface CodeBlockProps extends HTMLAttributes<HTMLElement> {
1818
interface CodeContentProps {
1919
children: ReactNode
2020
label?: string
21-
tabIndex?: number
2221
}
2322

24-
export function CodeContent({ children, label = 'Code sample', tabIndex }: CodeContentProps) {
23+
export function CodeContent({ children, label = 'Code sample' }: CodeContentProps) {
2524
return (
2625
<ScrollRegion
2726
label={label}
28-
tabIndex={tabIndex}
29-
className='p-4 [&_code]:block [&_code]:bg-transparent [&_code]:p-0 [&_code]:font-normal [&_code]:text-docs-code [&_pre]:m-0 [&_pre]:w-max [&_pre]:min-w-full [&_pre]:bg-transparent! [&_pre]:p-0 [&_pre]:font-mono [&_pre]:text-docs-code [&_pre]:[font-variant-ligatures:none]'
27+
className='p-4 [&_code]:block [&_code]:bg-transparent [&_code]:p-0 [&_code]:font-normal [&_code]:text-docs-code [&_pre]:m-0 [&_pre]:w-max [&_pre]:min-w-full [&_pre]:bg-transparent! [&_pre]:p-0 [&_pre]:font-mono [&_pre]:text-docs-code'
3028
>
3129
{children}
3230
</ScrollRegion>

‎packages/emcn-docs/src/components/scroll-region/scroll-region.tsx‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,13 @@ interface ScrollRegionProps extends HTMLAttributes<HTMLDivElement> {
99
label: string
1010
}
1111

12-
/**
13-
* Keyboard scrolling is reachable only when this region has horizontal overflow, unless a caller
14-
* sets `tabIndex` to keep it always (or never) in the tab order.
15-
*/
16-
export function ScrollRegion({
17-
label,
18-
className,
19-
children,
20-
tabIndex,
21-
...props
22-
}: ScrollRegionProps) {
23-
const region = useScrollEdges('horizontal', { tabStop: tabIndex === undefined })
12+
/** Keyboard scrolling is reachable only when this region has horizontal overflow. */
13+
export function ScrollRegion({ label, className, children, ...props }: ScrollRegionProps) {
14+
const region = useScrollEdges('horizontal', { tabStop: true })
2415
return (
2516
<div
2617
{...props}
2718
ref={region}
28-
tabIndex={tabIndex ?? 0}
2919
role='region'
3020
aria-label={label}
3121
className={cn(docsScrollAreaClass, 'min-w-0 overflow-x-auto ', className)}

‎packages/emcn-docs/src/components/tabs/tabs.tsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ export function Tab({
315315
id,
316316
className,
317317
children,
318-
tabIndex = 0,
319318
'aria-labelledby': labelledBy,
320319
...props
321320
}: TabProps) {
@@ -326,7 +325,6 @@ export function Tab({
326325
{...props}
327326
keepMounted
328327
inert={false}
329-
tabIndex={active ? tabIndex : -1}
330328
value={value}
331329
id={id ?? context?.panelIds.get(value) ?? `${context?.baseId}-${encodeURIComponent(value)}`}
332330
aria-labelledby={labelledBy ?? `${context?.baseId}-${encodeURIComponent(value)}-trigger`}

0 commit comments

Comments
 (0)