Skip to content

Commit b1a1177

Browse files
committed
oopsy
1 parent f56897d commit b1a1177

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

packages/interact/docs/guides/conditions-and-media-queries.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,6 @@ effect applies to; without it the predicate is appended to the element's own sel
5656
}
5757
```
5858

59-
> There is no container-query condition type. Scope by viewport with a `media` condition, or by
60-
> ancestor with a `selector` condition.
61-
6259
## Cascading of effects
6360

6461
Interact allows you to apply multiple effects on the same target and have them cascade, just like they do in CSS.

packages/interact/src/handlers/eventTrigger.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ function addEventTriggerHandler(
194194
} else {
195195
const events = genericConfig.toggle ?? [];
196196
events.forEach((eventType) => {
197+
if (eventType === 'keydown') {
198+
// A keydown listener is useless on an element the keyboard cannot reach.
199+
source.tabIndex = 0;
200+
}
197201
const passive = eventType !== 'keydown';
198202
const opts = { once, passive };
199203
addListener(source, eventType, opts);

packages/interact/test/mini.spec.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,6 +2978,18 @@ describe('interact (mini)', () => {
29782978
expect.any(Object),
29792979
);
29802980
});
2981+
2982+
it('should make the source focusable so the keydown listener is reachable', () => {
2983+
Interact.setup({ allowA11yTriggers: true });
2984+
Interact.create(getA11yConfig('click', 'click-tabindex'));
2985+
a11yElement = document.createElement('div');
2986+
2987+
expect(a11yElement.tabIndex).toBe(-1);
2988+
2989+
add(a11yElement, 'click-tabindex');
2990+
2991+
expect(a11yElement.tabIndex).toBe(0);
2992+
});
29812993
});
29822994

29832995
describe('hover trigger with allowA11yTriggers flag', () => {

0 commit comments

Comments
 (0)