Skip to content

Commit 084ce5a

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(ui): make closed table sidebars inert and strengthen focus ring
1 parent 4a3986b commit 084ce5a

6 files changed

Lines changed: 33 additions & 25 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-layout.test.tsx‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ describe('table sidebar layout', () => {
4545
expect(dialog.getAttribute('aria-label')).toBe('Configure workflow')
4646
expect(dialog.classList.contains('translate-x-0')).toBe(true)
4747
expect(dialog.classList.contains('shadow-overlay')).toBe(true)
48+
expect(dialog.hasAttribute('inert')).toBe(false)
4849

4950
input.value = 'Edited workflow'
5051
scrollBody.scrollTop = 64
@@ -56,9 +57,11 @@ describe('table sidebar layout', () => {
5657
expect(scrollBody.scrollTop).toBe(64)
5758
expect(dialog.classList.contains('translate-x-full')).toBe(true)
5859
expect(dialog.classList.contains('shadow-overlay')).toBe(false)
60+
expect(dialog.hasAttribute('inert')).toBe(true)
5961

6062
render(true)
6163
expect(dialog.classList.contains('translate-x-0')).toBe(true)
64+
expect(dialog.hasAttribute('inert')).toBe(false)
6265
expect(input.value).toBe('Edited workflow')
6366
expect(scrollBody.scrollTop).toBe(64)
6467
})

‎apps/sim/app/workspace/[workspaceId]/tables/[tableId]/components/table-sidebar-layout.tsx‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export function TableSidebarShell({
1717
<aside
1818
role='dialog'
1919
aria-label={ariaLabel}
20+
inert={!open}
2021
className={cn(
2122
'absolute top-0 right-0 bottom-0 z-[var(--z-modal)] flex w-[400px] flex-col overflow-hidden border-[var(--border)] border-l bg-[var(--bg)] transition-transform duration-200 ease-out',
2223
open ? 'translate-x-0 shadow-overlay' : 'translate-x-full'

‎packages/emcn/src/components/button/button.test.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,12 @@ describe('Button shared action geometry', () => {
107107
expect(baseOnly).not.toContain('sm:size')
108108
})
109109

110-
it('offers the existing muted keyboard ring without changing the default', () => {
110+
it('offers the shared keyboard ring without changing the default', () => {
111111
const before = renderToStaticMarkup(
112112
<Button
113113
variant='ghost'
114114
size='sm'
115-
className='focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--text-muted)_30%,transparent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)]'
115+
className='focus-visible:ring-2 focus-visible:ring-[var(--text-icon)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)]'
116116
>
117117
Open
118118
</Button>

‎packages/emcn/src/components/overlay-action-button/overlay-action-button.test.tsx‎

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,28 +43,32 @@ const PREVIOUS = [
4343
] as const
4444

4545
describe('OverlayActionButton', () => {
46-
it.each(PREVIOUS)('preserves the previous $name markup', ({ props, variant, className }) => {
47-
const view = mount(
48-
<>
49-
<Button variant={variant} aria-label='Copy' className={`${className} shrink-0`}>
50-
<svg className='size-[10px]' aria-hidden='true' />
51-
</Button>
52-
<OverlayActionButton {...props} aria-label='Copy' className='shrink-0'>
53-
<svg className='size-[10px]' aria-hidden='true' />
54-
</OverlayActionButton>
55-
</>
56-
)
57-
const [previous, current] = view.querySelectorAll('button')
58-
/** The old border-1 token aliases border; class order changes when recipes are composed. */
59-
for (const button of [previous, current]) {
60-
button.className = button.className
61-
.replaceAll('--border-1', '--border')
62-
.split(/\s+/)
63-
.sort()
64-
.join(' ')
46+
it.each(PREVIOUS)(
47+
'preserves the previous $name visual treatment',
48+
({ props, variant, className }) => {
49+
const view = mount(
50+
<>
51+
<Button variant={variant} aria-label='Copy' className={`${className} shrink-0`}>
52+
<svg className='size-[10px]' aria-hidden='true' />
53+
</Button>
54+
<OverlayActionButton {...props} aria-label='Copy' className='shrink-0'>
55+
<svg className='size-[10px]' aria-hidden='true' />
56+
</OverlayActionButton>
57+
</>
58+
)
59+
const [previous, current] = view.querySelectorAll('button')
60+
/** The old border-1 token aliases border; its hover border repeats the resting border. */
61+
for (const button of [previous, current]) {
62+
button.className = button.className
63+
.replaceAll('--border-1', '--border')
64+
.split(/\s+/)
65+
.filter((token) => token !== 'hover-hover:border-[var(--border)]')
66+
.sort()
67+
.join(' ')
68+
}
69+
expect(current.outerHTML).toBe(previous.outerHTML)
6570
}
66-
expect(current.outerHTML).toBe(previous.outerHTML)
67-
})
71+
)
6872

6973
it('forwards refs and native props through a tooltip and suppresses disabled clicks', () => {
7074
vi.useFakeTimers()

‎packages/emcn/src/components/overlay-action-button/overlay-action-button.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Button, type ButtonProps } from '../button/button'
55

66
/** Transparent, bordered icon action over code or preview content. */
77
export const overlayActionButtonVariants = cva(
8-
'cursor-pointer border border-[var(--border)] bg-transparent p-0 backdrop-blur-xs hover-hover:bg-[var(--surface-3)] dark:hover-hover:bg-[var(--surface-5)] hover-hover:border-[var(--border)]',
8+
'cursor-pointer border border-[var(--border)] bg-transparent p-0 backdrop-blur-xs hover-hover:bg-[var(--surface-3)] dark:hover-hover:bg-[var(--surface-5)]',
99
{
1010
variants: {
1111
size: {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
/** Opt-in ring for controls on `--surface-2`; ordinary Button focus remains unchanged. */
22
export const mutedFocusRingClass =
3-
'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-[color-mix(in_srgb,var(--text-muted)_30%,transparent)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)]'
3+
'focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-[var(--text-icon)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--surface-2)]'

0 commit comments

Comments
 (0)