Skip to content

Commit 1c4f1a7

Browse files
committed
fix(cdk-experimental/listbox): use meta as alternative to ctrl
1 parent 18ddea3 commit 1c4f1a7

File tree

1 file changed

+13
-9
lines changed
  • src/cdk-experimental/ui-patterns/listbox

1 file changed

+13
-9
lines changed

src/cdk-experimental/ui-patterns/listbox/listbox.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,13 @@ export class ListboxPattern<V> {
131131
.on(Modifier.Shift, 'Enter', () => this._updateSelection({selectFromAnchor: true}))
132132
.on(Modifier.Shift, this.prevKey, () => this.prev({toggle: true}))
133133
.on(Modifier.Shift, this.nextKey, () => this.next({toggle: true}))
134-
.on(Modifier.Ctrl | Modifier.Shift, 'Home', () => this.first({selectFromActive: true}))
135-
.on(Modifier.Ctrl | Modifier.Shift, 'End', () => this.last({selectFromActive: true}))
136-
.on(Modifier.Ctrl, 'A', () => this._updateSelection({selectAll: true}));
134+
.on([Modifier.Ctrl, Modifier.Meta], 'A', () => this._updateSelection({selectAll: true}))
135+
.on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'Home', () =>
136+
this.first({selectFromActive: true}),
137+
)
138+
.on([Modifier.Ctrl | Modifier.Shift, Modifier.Meta | Modifier.Shift], 'End', () =>
139+
this.last({selectFromActive: true}),
140+
);
137141
}
138142

139143
if (!this.followFocus() && this.inputs.multi()) {
@@ -148,12 +152,12 @@ export class ListboxPattern<V> {
148152

149153
if (this.inputs.multi() && this.followFocus()) {
150154
manager
151-
.on(Modifier.Ctrl, this.prevKey, () => this.prev())
152-
.on(Modifier.Ctrl, this.nextKey, () => this.next())
153-
.on(Modifier.Ctrl, ' ', () => this._updateSelection({toggle: true}))
154-
.on(Modifier.Ctrl, 'Enter', () => this._updateSelection({toggle: true}))
155-
.on(Modifier.Ctrl, 'Home', () => this.first()) // TODO: Not in spec but prob should be.
156-
.on(Modifier.Ctrl, 'End', () => this.last()); // TODO: Not in spec but prob should be.
155+
.on([Modifier.Ctrl, Modifier.Meta], this.prevKey, () => this.prev())
156+
.on([Modifier.Ctrl, Modifier.Meta], this.nextKey, () => this.next())
157+
.on([Modifier.Ctrl, Modifier.Meta], ' ', () => this._updateSelection({toggle: true}))
158+
.on([Modifier.Ctrl, Modifier.Meta], 'Enter', () => this._updateSelection({toggle: true}))
159+
.on([Modifier.Ctrl, Modifier.Meta], 'Home', () => this.first()) // TODO: Not in spec but prob should be.
160+
.on([Modifier.Ctrl, Modifier.Meta], 'End', () => this.last()); // TODO: Not in spec but prob should be.
157161
}
158162

159163
return manager;

0 commit comments

Comments
 (0)