Skip to content
This repository was archived by the owner on Jan 30, 2025. It is now read-only.
This repository was archived by the owner on Jan 30, 2025. It is now read-only.

Keyboard doesn't hold selection #284

@imiric

Description

@imiric

On current main (12eeeb5) the following test:

// Replicates the test from https://playwright.dev/docs/api/class-keyboard
t.Run("hold", func(t *testing.T) {
t.Skip("FIXME")
p := tb.NewPage(nil)
kb := p.(*common.Page).Keyboard //nolint: forcetypeassert
p.SetContent(`<input type="textarea">`, nil)
el := p.Query("input")
p.Focus("input", nil)
kb.Type("Hello World!", nil)
require.Equal(t, "Hello World!", el.InputValue(nil))
kb.Press("ArrowLeft", nil)
// Should hold the key until Up() is called.
kb.Down("Shift")
for i := 0; i < len(" World"); i++ {
kb.Press("ArrowLeft", nil)
}
// Should release the key but the selection should remain active.
kb.Up("Shift")
// Should delete the selection.
kb.Press("Backspace", nil)
assert.Equal(t, "Hello!", el.InputValue(nil))
})

... fails with:

expected: "Hello!"
actual  : "Hell World!"

I'm not sure if this is an issue with the Keyboard.pressedKeys implementation, only with the Shift key and keeping the selection, or something else.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingplaywrightIssue relating to Playwright compatibility

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions