|
|
Chromium Code Reviews|
Created:
4 years, 5 months ago by sammiequon Modified:
4 years, 5 months ago CC:
chromium-reviews, arv+watch_chromium.org, oshima+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@lkgr Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionPin keyboard use enter to submit when focus is not on a button.
BUG=624191
CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation
Committed: https://crrev.com/9c8327e6e81fc97b5b2c3480c2671b6225e85d6c
Cr-Commit-Position: refs/heads/master@{#404904}
Patch Set 1 #
Total comments: 2
Patch Set 2 : Fixed patch set 1 errors. #
Total comments: 2
Patch Set 3 : Rebased. #
Total comments: 1
Patch Set 4 : Fixed patch set 2 errors. #
Total comments: 6
Patch Set 5 : Fixed patch set 4 errors. #Patch Set 6 : Rebased. #Patch Set 7 : Rebased. #Patch Set 8 : Passes closure compiliation. #
Total comments: 1
Patch Set 9 : Compatiable with closure compiler. #
Messages
Total messages: 47 (19 generated)
Description was changed from ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 ========== to ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation ==========
Description was changed from ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation ========== to ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation ==========
sammiequon@chromium.org changed reviewers: + jdufault@chromium.org
jdufault@ - Please take a look.
On 2016/06/30 21:59:29, sammiequon wrote: > jdufault@ - Please take a look. If you revert this change are you still able to reproduce the paper-button animation glitches when you tab/spacebar really fast?
https://codereview.chromium.org/2119713003/diff/1/chrome/browser/resources/ch... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html (right): https://codereview.chromium.org/2119713003/diff/1/chrome/browser/resources/ch... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html:111: on-focus="onButtonFocus_" Can we use one of the paper-button properties instead of intercepting focus events? active[1], focused, and receivedFocusFromKeyboard all look very interesting. 1: https://elements.polymer-project.org/elements/paper-button#property-active
https://codereview.chromium.org/2119713003/diff/1/chrome/browser/resources/ch... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html (right): https://codereview.chromium.org/2119713003/diff/1/chrome/browser/resources/ch... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html:111: on-focus="onButtonFocus_" On 2016/06/30 22:18:44, jdufault wrote: > Can we use one of the paper-button properties instead of intercepting focus > events? > > active[1], focused, and receivedFocusFromKeyboard all look very interesting. > > 1: https://elements.polymer-project.org/elements/paper-button#property-active Done.
https://codereview.chromium.org/2119713003/diff/20001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): https://codereview.chromium.org/2119713003/diff/20001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:62: if (this.focusedElement_ != event.target) Can we traverse the DOM to find the focused element instead of caching it? Does document.activeElement work?
https://codereview.chromium.org/2119713003/diff/20001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): https://codereview.chromium.org/2119713003/diff/20001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:62: if (this.focusedElement_ != event.target) On 2016/07/01 21:20:52, jdufault wrote: > Can we traverse the DOM to find the focused element instead of caching it? Does > document.activeElement work? document.activeElement always returns the button if you tap it. But I want to send focus back to the input if the previous focused element, so I cached it. I think we can replace event.target with document.activeElement thought.
https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:63: this.focus(); Can this just be // Only focus buttons if the user tabbed to them. if (!event.target.receivedFocusFromKeyboard) this.focus() If that works, then all the other changes can be reverted.
On 2016/07/06 19:07:05, jdufault wrote: > https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... > File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): > > https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... > chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:63: this.focus(); > Can this just be > > // Only focus buttons if the user tabbed to them. > if (!event.target.receivedFocusFromKeyboard) > this.focus() > > If that works, then all the other changes can be reverted. That works, except if we tab to a number, then click it with mouse, the focus goes to the input. Is that what we want?
On 2016/07/06 19:23:05, sammiequon wrote: > On 2016/07/06 19:07:05, jdufault wrote: > > > https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... > > File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): > > > > > https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... > > chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:63: > this.focus(); > > Can this just be > > > > // Only focus buttons if the user tabbed to them. > > if (!event.target.receivedFocusFromKeyboard) > > this.focus() > > > > If that works, then all the other changes can be reverted. > > That works, except if we tab to a number, then click it with mouse, the focus > goes to the input. Is that what we want? If we want to maintain that behavior, then I think instead of tracking the focused element we should just track if the user used tabbing (and make sure to reset the tab behavior if the user selected the input element or the element was focused), so something along the lines of: onNumberTap_: function() { // ... if (event.target == this.$$('#pin-input')) this.didUseTabNavigation_ = false; else if (event.target.receivedFocusFromKeyboard) this.didUseTabNavigation_ = true; if (!this.didUseTabNavigation_) this.focus(); // ... }, focus: function() { // ... this.didUseTabNavigation_ = false; // ... } Doing something like this removes the second event handler, which is nice because it keeps all of the logic in one place. But I think having click reset focus is fine, so the approach discussed in the original comment is good enough (so no need to keep the didUseTabNavigation_ variable).
Patchset #4 (id:50001) has been deleted
On 2016/07/06 19:48:35, jdufault wrote: > On 2016/07/06 19:23:05, sammiequon wrote: > > On 2016/07/06 19:07:05, jdufault wrote: > > > > > > https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... > > > File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): > > > > > > > > > https://codereview.chromium.org/2119713003/diff/40001/chrome/browser/resource... > > > chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:63: > > this.focus(); > > > Can this just be > > > > > > // Only focus buttons if the user tabbed to them. > > > if (!event.target.receivedFocusFromKeyboard) > > > this.focus() > > > > > > If that works, then all the other changes can be reverted. > > > > That works, except if we tab to a number, then click it with mouse, the focus > > goes to the input. Is that what we want? > > If we want to maintain that behavior, then I think instead of tracking the > focused element we should just track if the user used tabbing (and make sure to > reset the tab behavior if the user selected the input element or the element was > focused), so something along the lines of: > > onNumberTap_: function() { > // ... > if (event.target == this.$$('#pin-input')) > this.didUseTabNavigation_ = false; > else if (event.target.receivedFocusFromKeyboard) > this.didUseTabNavigation_ = true; > > if (!this.didUseTabNavigation_) > this.focus(); > // ... > }, > > focus: function() { > // ... > this.didUseTabNavigation_ = false; > // ... > } > > Doing something like this removes the second event handler, which is nice > because it keeps all of the logic in one place. > > But I think having click reset focus is fine, so the approach discussed in the > original comment is good enough (so no need to keep the didUseTabNavigation_ > variable). Done.
https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html (right): https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html:143: <inner-text>2</inner-text> Revert all changes in this file. https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:41: pinInput.focus(); Revert these changes. https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:49: // If the number received focus from the mouse click, we trasnfer the focus nit: transfer Can you update the comment to explain why? Right now it just describes the code.
Patchset #5 (id:90001) has been deleted
https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html (right): https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.html:143: <inner-text>2</inner-text> On 2016/07/06 21:08:51, jdufault wrote: > Revert all changes in this file. Done. https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:41: pinInput.focus(); On 2016/07/06 21:08:51, jdufault wrote: > Revert these changes. Done. https://codereview.chromium.org/2119713003/diff/70001/chrome/browser/resource... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:49: // If the number received focus from the mouse click, we trasnfer the focus On 2016/07/06 21:08:51, jdufault wrote: > nit: transfer > > Can you update the comment to explain why? Right now it just describes the code. Done.
lgtm
sammiequon@chromium.org changed reviewers: + xiyuan@chromium.org
xiyuan@ - Please take a look.
lgtm
The CQ bit was checked by sammiequon@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: closure_compilation on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/closure_compila...)
The CQ bit was checked by sammiequon@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from xiyuan@chromium.org, jdufault@chromium.org Link to the patchset: https://codereview.chromium.org/2119713003/#ps130001 (title: "Rebased.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Try jobs failed on following builders: closure_compilation on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/closure_compila...)
The CQ bit was checked by sammiequon@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: closure_compilation on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/closure_compila...)
jdufault@ -Updated to pass closure compiliation. Please take a look.
https://codereview.chromium.org/2119713003/diff/170001/chrome/browser/resourc... File chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js (right): https://codereview.chromium.org/2119713003/diff/170001/chrome/browser/resourc... chrome/browser/resources/chromeos/quick_unlock/pin_keyboard.js:65: if (!event.target.classList.contains('keyboard-focus')) What about just casting event.target to the right type? Checking the active class state seems like a pretty round-about way to do this.
lgtm
The CQ bit was checked by sammiequon@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from xiyuan@chromium.org Link to the patchset: https://codereview.chromium.org/2119713003/#ps190001 (title: "Compatiable with closure compiler.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Description was changed from ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation ========== to ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation ==========
Message was sent while issue was closed.
Committed patchset #9 (id:190001)
Message was sent while issue was closed.
Description was changed from ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation ========== to ========== Pin keyboard use enter to submit when focus is not on a button. BUG=624191 CQ_INCLUDE_TRYBOTS=tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/9c8327e6e81fc97b5b2c3480c2671b6225e85d6c Cr-Commit-Position: refs/heads/master@{#404904} ==========
Message was sent while issue was closed.
Patchset 9 (id:??) landed as https://crrev.com/9c8327e6e81fc97b5b2c3480c2671b6225e85d6c Cr-Commit-Position: refs/heads/master@{#404904} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
