Skip to content

Conversation

@stephannv
Copy link
Contributor

@stephannv stephannv commented Dec 27, 2024

📝 Description

Trying to focus on next input doesn't work because simple-mask-money is capturing tab key presses. This issue is similar to #67

I tried to implement a test for this case but it seems cypress doesn't support Tab key press properly (even using cypress-plugin-tab or cypress-real-events packages):

But I implemented a test using Playright on my local dev and I could reproduce the failing case and fix it with this patch.

Before patch:
Screenshot 2024-12-27 at 13 39 52

After patch:
Screenshot 2024-12-27 at 13 40 08

The test code:

test('allow focus change', async ({ page }) => {
  await page.goto('./e2e/index.html');

  await expect(page.getByTestId('input')).not.toBeFocused()
  await page.locator('input').focus()
  await expect(page.getByTestId('input')).toBeFocused()
  await page.keyboard.press('1')
  await page.keyboard.press('Tab');
  await expect(page.getByTestId('input')).not.toBeFocused()
});

@codermarcos codermarcos self-requested a review January 16, 2025 17:42
@codermarcos codermarcos added the bug A confirmed bug label Jan 16, 2025
@codermarcos codermarcos merged commit 26c3ca0 into codermarcos:main Jan 21, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug A confirmed bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants