Skip to content

Commit

Permalink
chore(bidi): support ControlOrMeta key (#34341)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Jan 15, 2025
1 parent 224d7bf commit 07f4254
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/playwright-core/src/server/bidi/bidiInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type * as types from '../types';
import type { BidiSession } from './bidiConnection';
import * as bidi from './third_party/bidiProtocol';
import { getBidiKeyValue } from './third_party/bidiKeyboard';
import { resolveSmartModifierString } from '../input';

export class RawKeyboardImpl implements input.RawKeyboard {
private _session: BidiSession;
Expand All @@ -32,12 +33,14 @@ export class RawKeyboardImpl implements input.RawKeyboard {
}

async keydown(modifiers: Set<types.KeyboardModifier>, keyName: string, description: input.KeyDescription, autoRepeat: boolean): Promise<void> {
keyName = resolveSmartModifierString(keyName);
const actions: bidi.Input.KeySourceAction[] = [];
actions.push({ type: 'keyDown', value: getBidiKeyValue(keyName) });
await this._performActions(actions);
}

async keyup(modifiers: Set<types.KeyboardModifier>, keyName: string, description: input.KeyDescription): Promise<void> {
keyName = resolveSmartModifierString(keyName);
const actions: bidi.Input.KeySourceAction[] = [];
actions.push({ type: 'keyUp', value: getBidiKeyValue(keyName) });
await this._performActions(actions);
Expand Down

0 comments on commit 07f4254

Please sign in to comment.