Skip to content

Conversation

@duchenean
Copy link

Hello,

This is a small quality-of-life improvement. By adding type="button", the button no longer steals focus in edit/add forms. This also allows users to submit the form by pressing Enter while focused in the title field.

Before this change, something odd happened: pressing Enter while focused in the title field would delete the selected content. If the field wasn’t visible (for example, inside another fieldset), this could lead to accidental deletions without the user even noticing.

Thanks! ✌️

  • I signed and returned the Plone Contributor Agreement, and received and accepted an invitation to join a team in the Plone GitHub organization.
  • I verified there aren't any other open pull requests for the same change.
  • I followed the guidelines in Contributing to Plone.
  • I successfully ran code quality checks on my changes locally.
  • I successfully ran tests on my changes locally.

@duchenean duchenean changed the title Add type='button' to prevent the button to be focused by default in a form fix(pat-contentbrowser): Add type='button' to prevent the button to be focused by default in a form Jan 13, 2026
@petschki
Copy link
Member

Wow, thank you for this fix! I wasn't aware of that. I'll rebase this and merge asap...

@petschki
Copy link
Member

note: feel free to assign me as reviewer at any time! then this gets fixed faster 👍🏼

@petschki petschki force-pushed the contentbrowser-selected-item-button-fix branch from 5e8d54d to 5ab8778 Compare January 15, 2026 07:28
@petschki petschki self-requested a review January 15, 2026 07:30
Copy link
Member

@petschki petschki left a comment

Choose a reason for hiding this comment

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

Hm ... one thing: I've quickly tested your branch:

✅ hitting enter in the title field with items inside relateditems widget doesn't remove the items anymore
❌ saving the document with focused title field still doesn't work though

do you eventually have time to check that? if not, I'm good to merge this because removing the item is very bad.

@duchenean duchenean closed this Jan 16, 2026
@duchenean duchenean reopened this Jan 16, 2026
@duchenean
Copy link
Author

Hello @petschki,

Of course, I’ll take a deeper look on Monday and keep you posted.
I tested it on a heavily customized Plone site and was able to submit the form (I think it might be because I swapped some buttons in the form view), but I’ll try on a bare-bones Plone site to be sure.

Thanks again 😄

@duchenean
Copy link
Author

@petschki

I just tested on a fresh Plone site and it's working just fine, I'm able to submit the form by pressing enter while focused on the title.
Check this short video

enter_submit_plone_6_2_a2.mp4

Here is my version overview
Plone 6.2.0a2.dev0 (6201)
CMF 3.8
Zope 6.0b2
Python 3.14.0 (main, Oct 17 2025, 10:22:16) [GCC 14.2.0]

I also tried on Plone 6.1.4 (latest release) and it was working as well.

@petschki
Copy link
Member

petschki commented Jan 20, 2026

If you do not touch related items its ok. Once you've added them, the submit doesn't work anymore. If you cannot reproduce or do not see a quick solution for that, I'm fine to merge this fix.

EDIT: I see you have related items in the video, so maybe its because pat-contentbrowser keyboard events only get initialized, when the browser opens the first time.

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.

3 participants