Bug 1629364 Comment 9 Edit History

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

(In reply to Alessandro Castellani (:aleca) from comment #6)
> Can you rebase the patch with the latest merge?

Ok, will do!

(In reply to Alessandro Castellani (:aleca) from comment #7)
> I was looking at this again and I was wondering if you considered using the `onblur` attribute to strip away leftover whitespaces.

I did and discarded the idea. `onblur` is too late, as we seem to agree that we want to prevent scenarios of (input.value==whitespace-only) to even occur and remain in the UI for some time. Before blur, as long as the whitespace-only input.value still hangs around, keyboard-navigation from input to last pill via cursor is blocked, which is a highly irritating/annoying UI state as the trouble-causing whitespace is invisible.

> Also, we should definitely open a bug to replace the `keypress` with `keydown` or `onbeforeinput`.

Generally yes, although I don't see `keypress` disappearing any time soon (and if someone could enlighten me as to WHY keypress is deprecated, that would be great). So maybe we can do that later. I doubt that `onbeforeinput` will be helpful in our case. As for keydown/keyup, iirc, tab key  might cause problems, as keydown and keyup used to fire on different elements when [shift+]tab changes focus. Personally, I consider keypress the safer event as it really ensures that an actual full keypress (=keydown and keyup) has occured on the same element.
(In reply to Alessandro Castellani (:aleca) from comment #6)
> Can you rebase the patch with the latest merge?

Ok, will do!

(In reply to Alessandro Castellani (:aleca) from comment #7)
> I was looking at this again and I was wondering if you considered using the `onblur` attribute to strip away leftover whitespaces.

I did and discarded the idea. `onblur` is too late, as we seem to agree that we want to prevent scenarios of (input.value==whitespace-only) to even occur and remain in the UI for some time. Before blur, as long as the whitespace-only input.value still hangs around, keyboard-navigation from input to last pill via cursor is blocked, which is a highly irritating/annoying UI state as the trouble-causing whitespace is invisible.

> Also, we should definitely open a bug to replace the `keypress` with `keydown` or `onbeforeinput`.

Generally yes, although I don't see `keypress` disappearing any time soon, so maybe it's not urgent. I doubt that `onbeforeinput` will be helpful in our case. As for keydown/keyup, iirc, tab key  might cause problems, as keydown and keyup used to fire on different elements when [shift+]tab changes focus, and keypress didn't suffer from that. Alas, it's deprecated...

If you find yourself wondering (like me) wrt the WHY of keypress deprecation:
https://www.mutuallyhuman.com/blog/keydown-is-the-only-keyboard-event-we-need/

Back to Bug 1629364 Comment 9