New issue
Advanced search Search tips

Issue 685699 link

Starred by 1 user

Issue metadata

Status: Duplicate
Owner: ----
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: 2017-01-26
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

[Dialogs] Add a universal Enter handler for cr-dialog

Project Member Reported by tommycli@chromium.org, Jan 26 2017

Issue description

Currently we have a mishmash of onKeypress and iron-a11y-keys to handle the Enter key in MD Settings dialogs.

We can update cr-dialog to have a universal handler following the example here:
https://cs.chromium.org/chromium/src/ui/webui/resources/js/cr/ui/overlay.js?q=overlay.js&sq=package:chromium&l=58

We need to come up with a way of either tagging or finding the default button.
 

Comment 1 by dpa...@chromium.org, Jan 26 2017

Cc: dbeam@chromium.org
Perhaps just querying the cr-dialog's DOM for the "action-button" CSS class could be a way to find the default button. Then we could query whether this button is enabled and if enabled, simulate a click/tap on it.

A different approach I had thought initially here, for discussion (perhaps more
complicated than previous one).

We could add two new methods to cr-dialog, canSubmit() and submit(). The default implementations will be

canSubmit: function() { return false; }
submit: function() { // no-op; }

Users of cr-dialog are not subclasses, just instances of <cr-dialog> itself, so in order to override those methods they would need to do something as follows.

myDialog.canSubmit = function() { /* validation logic here */ };
myDialog.submit = function() { /* perform submit action here */ };

When an 'Enter' key is detected, the cr-dialog would simply do
if (this.canSubmit() && !this.forbiddenTagnames.has(e.target.tagName))
  this.submit();

where forbiddenTagnames is similar to the link posted by @tommycli above.

Finally that entire functionality would be opt-in as follows
<dialog is="cr-dialog" submit-on-enter>...</dialog>
^ Great thoughts.

Comment 3 by chaok@google.com, Jan 26 2017

Labels: Hotlist-MD-Settings-PageA11y
NextAction: 2017-01-26

Comment 5 by dbeam@chromium.org, Feb 9 2017

Blocking: 671375
Cc: -tommycli@chromium.org
Labels: -Pri-3 Pri-2
Owner: tommycli@chromium.org
tommycli@: how many dialogs in md-settings currently don't have good default Enter handling?
They should all have Enter handlers now. They're just all implemented per-instance.

Comment 7 by dbeam@chromium.org, Feb 9 2017

Cc: tommycli@chromium.org
Labels: -Pri-2 -Hotlist-MD-Settings-PageA11y Pri-3
Owner: ----
Status: Available (was: Untriaged)
ah, nvm then

Comment 8 by dbeam@chromium.org, Feb 14 2017

Labels: Hotlist-MD-Settings-General

Comment 9 by dbeam@chromium.org, Feb 14 2017

Blocking: -671375
Project Member

Comment 10 by sheriffbot@chromium.org, Feb 15 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
@tommy: Is this bug a duplicate of issue 626420? Can we dedup? If not, is there anything left to do here?
Mergedinto: 626420
Status: Duplicate (was: Untriaged)
Agreed thanks.

Sign in to add a comment