Bug 1629364 Comment 14 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Alright. Here's whitespace handling reloaded. Starting from Alex' comment 13, I added some tweaks to further improve the UX.
- Per Alex comment 13, prevent the most likely way of whitespace-only input (pressing spacebar), and deal with any remaining whitespace-only on blur. However, main problem of this bug (invisible whitespace preventing keyboard navigation from input to pills) can still occur, as there's a number of other ways which can result in whitespace-only to remain in the input, e.g. deleting/dragging/cutting visible input text, but not all of the leading or trailing whitespace.
- The tweak: Let's address the key problem of this bug directly -  whitespace-only value in a recipient input should NOT per se block keyboard navigation into pills (backspace, cursor-left, home). We just have to put the brakes on repeated keypresses, and make sure cursor is on the left side of the input, so as to avoid accidents for backspace and unexpected jumps. So we allow controlled moving of focus, and onblur immediately deals with the rest. It just works :-)
- Whilst we are here, streamline resetAddressContainer() a bit, and trim invalid input text on blur if it hasn't been converted to a pill yet.

(In reply to Alessandro Castellani (:aleca) from comment #13)
> Review of attachment 9141516 [details] [diff] [review]:

Thank you. This review was a bit of a nut to crack, but ultimately helpful. ;-)
Alright. Here's whitespace handling reloaded. Starting from Alex' comment 13, I added some tweaks to further improve the UX.
- Per Alex comment 13, prevent the most likely way of whitespace-only input (pressing spacebar), and deal with any remaining whitespace-only on blur. However, main problem of this bug (invisible whitespace preventing keyboard navigation from input to pills) can still occur (before blur), as there's a number of other ways which can result in whitespace-only to remain in the input, e.g. deleting/dragging/cutting visible input text, but not all of the leading or trailing whitespace.
- The tweak: Let's address the key problem of this bug directly -  whitespace-only value in a recipient input should NOT per se block keyboard navigation into pills (backspace, cursor-left, home). We just have to put the brakes on repeated keypresses, and make sure cursor is on the left side of the input, so as to avoid accidents for backspace and unexpected jumps. So we allow controlled moving of focus, and onblur immediately deals with the rest. It just works :-)
- Whilst we are here, streamline resetAddressContainer() a bit, and trim invalid input text on blur if it hasn't been converted to a pill yet.

(In reply to Alessandro Castellani (:aleca) from comment #13)
> Review of attachment 9141516 [details] [diff] [review]:

Thank you. This review was a bit of a nut to crack, but ultimately helpful. ;-)

Back to Bug 1629364 Comment 14