Skip to content
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

feat: event leak demo #7376

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: lint errors
Nikolas Schröter authored and Nikolas Schröter committed Nov 16, 2024
commit 002fdf2a48a0a9e3bbbd0ccca57b6f327f42f716
11 changes: 6 additions & 5 deletions packages/react-aria-components/stories/EventLeaks.stories.tsx
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ let rows = [
{id: 6, name: 'NumberField', children: NumberFieldExample.render({}), interactions: ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Enter']},
{id: 7, name: 'TimeField', children: <TimeFieldExample />, interactions: ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Enter']},
{id: 8, name: 'DateField', children: <DateFieldExample />, interactions: ['ArrowRight', 'ArrowLeft', 'ArrowUp', 'ArrowDown', 'Enter']},
{id: 9, name: 'SearchField', children: <SearchFieldExample />, interactions: [' ', 'Enter', 'Escape',]},
{id: 9, name: 'SearchField', children: <SearchFieldExample />, interactions: [' ', 'Enter', 'Escape']},
{id: 10, name: 'Checkbox', children: <CheckboxExample />, interactions: [' ']},
{id: 11, name: 'CheckboxGroup', children: <CheckboxGroupExample />, interactions: [' ']},
{id: 12, name: 'Switch', children: <SwitchExample />, interactions: [' ', 'Enter']},
@@ -68,7 +68,7 @@ let rows = [
{id: 17, name: 'ComboBox', children: <ComboBoxExample />, interactions: ['ArrowUp', 'ArrowDown', 'ArrowRight', 'ArrowLeft', ' ', 'Enter', 'Escape']},
{id: 18, name: 'Disclosure', children: <DisclosureExample />, interactions: [' ', 'Enter']},
{id: 19, name: 'Toolbar', children: <ToolbarExample />, interactions: ['ArrowRight', 'ArrowLeft']},
{id: 20, name: 'Calendar', children: <CalendarExample />, interactions: ['Tab', 'Tab', 'ArrowRight', 'ArrowLeft']},
{id: 20, name: 'Calendar', children: <CalendarExample />, interactions: ['Tab', 'Tab', 'ArrowRight', 'ArrowLeft']}
];

let INTERACTION_KEYS = new Set([' ', 'Enter', 'Escape']);
@@ -121,7 +121,6 @@ const EventGridItem = (props: GridListItemProps) => {
// @ts-expect-error
children={children}
onKeyDown={onLeakedKeyboardEvent}
onKeyDownCapture={(e) => {console.log('capturing...', e)}}
style={{
display: 'inline-flex',
flex: 1,
@@ -181,8 +180,10 @@ export const EventLeakGrid = {
continue;
}

if (rows[index]?.interactions) {
for (const key of rows[index]?.interactions) {
let interactions = rows[index]?.interactions;

if (interactions) {
for (const key of interactions) {
await userEvent.keyboard(`{${key}}`);
await sleep(100);