Skip to content

[Details Block] The space key doesn't work (Firefox) #49679

Closed

Description

@gyurmey2

Description

The space key doesn't work when entering text in the "Details Summary" field. This only happens in Firefox browsers.

Step-by-step reproduction instructions

  1. Add Details block in Firefox browser.
  2. Go to the Details Summary field.
  3. Try entering any text including spaces.

Screenshots, screen recording, code snippet

details

Environment info

  • WordPress: 6.2
  • Theme: TT3
  • Browsers: Firefox 111.0.1, Firefox Developer 112.0b9, Firefox Nightly 113.0a1
  • OS: Windows 10

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Activity

  1. added
    [Block] Details
    on Apr 10, 2023
  2. t-hamano commented on Apr 10, 2023

    @t-hamano
    Contributor

    @gyurmey2
    Tahnks for the rerport. I was able to reproduce it too.

    Firefox Version: 111.0.1 (64-bit)

    f4b24416bed753812c0eb9857b798a01.mp4
  3. added
    [Type] Bug
    Browser Issues
    on Apr 10, 2023
  4. t-hamano commented on Apr 10, 2023

    @t-hamano
    Contributor

    I think this is a problem unique to Firefox. If I give the summary element, or any of its children, the contententeditable attribute and press the space key in the text, it is treated as a click event and no space is inserted.

    Here is the code I used to test:

    <!DOCTYPE html>
    <html lang="ja">
    <head>
    <meta charset="UTF-8">
    <title>Document</title>
    </head>
    <body>
    
    <details>
    <summary><div contenteditable>Editable Details Summary</div></summary>
    <p>Details Content</p>
    </details>
    
    <script>
    document.querySelector('summary').addEventListener('click', function(event) {
    	console.log( 'clicked!' );
    });
    </script>
    
    </body>
    </html>
  5. carolinan commented on Apr 16, 2023

    @carolinan
    Contributor

    I can reproduce this and I have tried to use different combinations of "KeyUp" instead of "onClick" for the prevent, but I have been unable to solve it.
    I tried both with the separate <summary> element as a wrapper for the RichText (the way the block is currently built) and using summary as a tag in the RichText.

  6. added
    Needs Dev
    Needs Technical Feedback
    on Apr 17, 2023
  7. moved this to Needs development in Polishon May 10, 2023
  8. talldan commented on May 11, 2023

    @talldan
    Contributor

    Here's the bug report for firefox - https://bugzilla.mozilla.org/show_bug.cgi?id=1822860. It has been triaged and accepted which is good.

    I'm not sure if we can add any workarounds to RichText, or if we should just wait for the firefox bug to be resolved. It seems like it's being considered a normal priority, but I left a comment asking why that is and if there's a workaround.

  9. talldan commented on May 11, 2023

    @talldan
    Contributor

    There's a suggestion for a workaround from a Firefox maintainer:

    Currently, the workaround is not use contenteditable in the elements or prevent default of space keydown events and do document.execCommand("insertText", false, " ").

    The latter sounds like a good option 👍

  10. self-assigned this
    on May 11, 2023
  11. added
    [Status] In Progress
    on May 11, 2023
  12. t-hamano commented on May 11, 2023

    @t-hamano
    Contributor

    I am trying to fix in #50540.

  13. moved this from Needs development to In progress in Polishon May 17, 2023
  14. removed
    Needs Dev
    on May 24, 2023
  15. removed
    [Status] In Progress
    on May 26, 2023
  16. moved this from In progress to Done in Polishon May 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Browser IssuesNeeds Technical Feedback[Block] Details[Type] Bug

Type

No type

Projects

  • Status
    Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions