mirror of
https://github.com/google/nomulus.git
synced 2025-06-21 03:40:47 +02:00
Listen to the user hitting enter in the lock/unlock modal input fields (#505)
* Listen to the user hitting enter in the lock/unlock modal input fields Listen to both, just in case one or the other is disabled * Don't require that the element exist
This commit is contained in:
parent
dda9b90587
commit
a9cfa1dc96
1 changed files with 18 additions and 1 deletions
|
@ -91,7 +91,7 @@ registry.registrar.RegistryLock.prototype.fillLocksPage_ = function(e) {
|
|||
lockEnabledForContact: locksDetails.lockEnabledForContact});
|
||||
|
||||
if (locksDetails.lockEnabledForContact) {
|
||||
// Listen to the lock-domain 'submit' button click as well as the enter key
|
||||
// Listen to the lock-domain 'submit' button click
|
||||
var lockButton = goog.dom.getRequiredElement('button-lock-domain');
|
||||
goog.events.listen(lockButton, goog.events.EventType.CLICK, this.onLockDomain_, false, this);
|
||||
// For all unlock buttons, listen and perform the unlock action if they're clicked
|
||||
|
@ -129,12 +129,29 @@ registry.registrar.RegistryLock.prototype.showModal_ = function(targetElement, d
|
|||
false,
|
||||
this);
|
||||
|
||||
// Listen to the "submit" click and also the user hitting enter
|
||||
goog.events.listen(
|
||||
goog.dom.getRequiredElement('domain-lock-submit'),
|
||||
goog.events.EventType.CLICK,
|
||||
e => this.lockOrUnlockDomain_(isLock, e),
|
||||
false,
|
||||
this);
|
||||
|
||||
[goog.dom.getElement('domain-lock-password'),
|
||||
goog.dom.getElement('domain-lock-input-value')].forEach(elem => {
|
||||
if (elem != null) {
|
||||
goog.events.listen(
|
||||
elem,
|
||||
goog.events.EventType.KEYPRESS,
|
||||
e => {
|
||||
if (e.keyCode === goog.events.KeyCodes.ENTER) {
|
||||
this.lockOrUnlockDomain_(isLock, e);
|
||||
}
|
||||
},
|
||||
false,
|
||||
this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue