Skip to content

fix: support .press() with Shift resulting in capitalisation - #238

Merged
cmorten merged 2 commits into
guidepup:mainfrom
AdamMagued:fix/press-shift-capitalisation
Sep 29, 2026
Merged

cmorten merged 2 commits into
guidepup:mainfrom
AdamMagued:fix/press-shift-capitalisation

Conversation

@AdamMagued

Copy link
Copy Markdown
Contributor

Issue

Fixes #8.

Details

Resolves an issue where calling await virtual.press("Shift+a+b+c") produced "abc" instead of "ABC".

When a Shift modifier is present, single-character keys are now capitalized and passed directly without key descriptor braces (which previously caused user-event to default to unshifted lowercase keycodes). Also updates the integration test assertions in test/int/press.int.test.ts accordingly.

CheckList

  • Has been tested (where required).

Comment thread src/Virtual.ts
...keys.map((key) => `{${key}}`),
...keys.map((key) => {
if (key.length === 1) {
return isShiftPressed ? key.toUpperCase() : key;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General note that this will handle alpha capitalisation but isn’t a general solution for shift behaviour, which is would require keyboard map logic to handle US/UK/other layouts and so on - but as a starter for 10 feels adequate!

@cmorten
cmorten merged commit e3ff1c7 into guidepup:main Sep 29, 2026
11 checks passed
@cmorten

cmorten commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Nice work 🚀 thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: support .press() with Shift resulting in capitalisation

2 participants