testcafe icon indicating copy to clipboard operation
testcafe copied to clipboard

Press space key does not work on focused button element

Open Nikolaj1010 opened this issue 2 years ago • 8 comments

Are you requesting a feature or reporting a bug? Bug

What is the current behavior? Pressing the space key on the focused button (the submit one) does not cause any reaction, but it should be the same as clicking on the button. This wrong behavior appears on Chrome and Edge, but it seems that it works on Firefox 90.0.2

What is the expected behavior? Pressing the space key on focused button (the submit one) should triggers click event which should redirect the user to "thank-you.html" test page displaying the text: "Thank you, " + inserted name from the input with label 'your name'

Steps to reproduce:

  1. Insert some text into the input with label 'your name'
  2. Click on the checkbox with text ' I have tried TestCafe'
  3. Pressing the tab key three times to focus the 'Submit' button
  4. Pressing the space key to simulate click event
  5. Page should displays the text "Thank you, [insert name from the first input]" but it does not happen

Tested page URL:

http://devexpress.github.io/testcafe/example/

Your complete test code (or attach your test files):

test('Should focus the "Submit" button by pressing tab key from previous element, then pressing space key to simulate click event on the button ', async () => {
    await t
        .typeText(Selector('#developer-name'), 'Nick')
        .click(Selector('#tried-test-cafe'))
        .pressKey('tab tab tab')
        .pressKey('space')
        .expect(Selector('#article-header').innerText).eql('Thank you, Nick!');
});

Your complete test report:

testcafeIssueAboutSpaceOnBtn

Your Environment details:

  • testcafe version: 1.15.0
  • node.js version: v14.16.1
  • browser name and version: Chrome Version 92.0.4515.131 and Edge Version 92.0.902.67
  • platform and version: Windows 10 Enterprise

Nikolaj1010 avatar Aug 11 '21 09:08 Nikolaj1010

Hello, I created a new issue with up-to-date information after you closed the old issue: https://github.com/DevExpress/testcafe/issues/2066 after a prolonged period of inactivity. This functionality is still needed so I hope that you are going to implement it as you promised here: https://github.com/DevExpress/testcafe/issues/2066#issuecomment-360395058. Thank you for the understanding.

Nikolaj1010 avatar Aug 11 '21 09:08 Nikolaj1010

We apologize for the inconvenience. This issue is re-prioritized and marked as a bug, so it won't be closed automatically anymore.

VasilyStrelyaev avatar Aug 12 '21 10:08 VasilyStrelyaev

This bug should be expanded to include the up and down keys as well, both of which can be defined to open a menu. I can provide documentation and a screen video to illustrate the bug, which seems more nuanced than is described here. I can get space and enter to open the menu but not shift focus to the first menu item. However, the up and down keys do not even open the menu.

chundhau avatar Sep 16 '21 15:09 chundhau

@chundhau, thank you for your feedback. We will take it into account. Also, it would be very helpful if you share a working example that illustrates your usage scenario.

aleks-pro avatar Sep 21 '21 07:09 aleks-pro

I can still see this issue popping up and space button is not even working with following hack.

await t.setTestSpeed(0.01); await t.pressKey('tab'); await t.setTestSpeed(0.01); await t.pressKey('tab'); await t.setTestSpeed(0.01); await t.pressKey('space space space space space space space') await t.wait(1000)

Please take it on priority to fix it.

onkarb68 avatar Jun 07 '22 20:06 onkarb68

Hi @onkarb68

We keep this issue in mind. We will update this thread once we have news. However, I cannot give you a precise date, as any estimate may be misleading.

Aleksey28 avatar Jun 09 '22 09:06 Aleksey28

Pressing buttons with space can be vital for testing accessibility and emulating behaviour of vision impaired people. It would be great if you fix it

yoksel avatar Aug 23 '22 17:08 yoksel

Hi @yoksel,

Yes, we know about this issue. We don't have any news yet, but we will update this thread once we have any results.

Aleksey28 avatar Aug 26 '22 13:08 Aleksey28

Hello, the issue with pressKey down occurs also at Firefox 105.

testcafe version: 1.18.4 Firefox version: 105.0.3 URL tested: http://devexpress.github.io/testcafe/example/

test('Should select Windows operating system as primary, press down key to select MacOS', async () => { await t .click('#windows') .expect(Selector('#windows').checked).eql(true) .expect(Selector('#macos').checked).eql(false) .pressKey('down') // on FF 105.0.3 this does not move to next radio item, on FF 104.0.1 it does and passes .pressKey('space') .expect(Selector('#windows').checked).eql(false) .expect(Selector('#macos').checked).eql(true); });

daimoonis avatar Oct 12 '22 11:10 daimoonis

Hi @daimoonis,

It isn't the same issue. However, we already know about this case and fixed it. This fix will be included in the nearest release.

Aleksey28 avatar Oct 13 '22 06:10 Aleksey28