Page MenuHomePhorge

Fix submitting forms in a new tab using Ctrl+Return
AcceptedPublic

Authored by BlankEclair on Aug 13 2024, 05:30.

Details

Summary

This commit adds a keydown listener to <input> elements to activate a flag when
Ctrl (and other keys) are pressed, which causes forms to be submitted to a new
tab.

This commit also modifies the click event listener for buttons to ignore
synthetic clicks from the browser, which is important as they clobber the
"new_tab" flag otherwise.

Closes T15914

Test Plan

Open the Advanced Search form, and do Ctrl+Return inside one of the text boxes
to ensure that the result is opened in a new tab. Also do a plain Return, plain
click on "Search", and Ctrl+Click on Search to check for regressions.

Diff Detail

Repository
rP Phorge
Branch
form-submit-with-ctrl-enter
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 1517
Build 1517: arc lint + arc unit

Event Timeline

Thanks. Tested and it works! no regressions.

I really don't know why it works :D really, I need more coffee. Personal approve in the meanwhile. Let's test more intensively in the meantime.

aklapper subscribed.

Thanks! While it does not work for all and anything (e.g. top bar search button), it is still an improvement when it comes to consistency between mouseclick and return/enter button, so I approve as I haven't seen any fallout and could not find collisions/interference with other existing functionality. (For the records, there is similar code existing in webroot/rsrc/externals/javelin/core/Event.js calling JX.Stratcom.listen() this way.)

Please feel free to arc land this branch.

This revision is now accepted and ready to land.Aug 19 2024, 09:45

@BlankEclair Do you want a little help to land this?

Essentially you should be able to run this whenever you want:

arc patch D25773
arc land