Add auto-focus to the default action in overlay dialogs
This commit is contained in:
committed by
Sebastiaan Janssen
parent
8c5f253b41
commit
040ebfe9dd
+2
-1
@@ -95,7 +95,8 @@ Use this directive to render an umbraco button. The directive can be used to gen
|
||||
size: "@?",
|
||||
alias: "@?",
|
||||
addEllipsis: "@?",
|
||||
showCaret: "@?"
|
||||
showCaret: "@?",
|
||||
autoFocus: "@?"
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
+5
-3
@@ -9,8 +9,10 @@ angular.module("umbraco.directives")
|
||||
}
|
||||
};
|
||||
|
||||
$timeout(function() {
|
||||
update();
|
||||
});
|
||||
if (attr.umbAutoFocus !== "false") {
|
||||
$timeout(function() {
|
||||
update();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
+2
-3
@@ -311,9 +311,8 @@ Opens an overlay to show a custom YSOD. </br>
|
||||
var submitOnEnter = document.activeElement.hasAttribute("overlay-submit-on-enter");
|
||||
var submitOnEnterValue = submitOnEnter ? document.activeElement.getAttribute("overlay-submit-on-enter") : "";
|
||||
|
||||
if(clickableElements.indexOf(activeElementType) === 0) {
|
||||
document.activeElement.trigger("click");
|
||||
event.preventDefault();
|
||||
if(clickableElements.indexOf(activeElementType) >= 0) {
|
||||
// don't do anything, let the browser Enter key handle this
|
||||
} else if(activeElementType === "TEXTAREA" && !submitOnEnter) {
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<button ng-if="vm.type === 'button'" type="button" class="btn umb-button__button {{vm.style}} umb-button--{{vm.size}}" ng-click="vm.clickButton($event)" hotkey="{{vm.shortcut}}" hotkey-when-hidden="{{vm.shortcutWhenHidden}}" ng-disabled="vm.disabled">
|
||||
<button ng-if="vm.type === 'button'" type="button" class="btn umb-button__button {{vm.style}} umb-button--{{vm.size}}" ng-click="vm.clickButton($event)" hotkey="{{vm.shortcut}}" hotkey-when-hidden="{{vm.shortcutWhenHidden}}" ng-disabled="vm.disabled" umb-auto-focus="{{vm.autoFocus && !vm.disabled ? 'true' : 'false'}}">
|
||||
<span class="umb-button__content" ng-class="{'-hidden': vm.innerState !== 'init'}">
|
||||
<i ng-if="vm.icon" class="{{vm.icon}} umb-button__icon"></i>
|
||||
{{vm.buttonLabel}}
|
||||
@@ -23,7 +23,7 @@
|
||||
</span>
|
||||
</button>
|
||||
|
||||
<button ng-if="vm.type === 'submit'" type="submit" class="btn umb-button__button {{vm.style}} umb-button--{{vm.size}}" hotkey="{{vm.shortcut}}" hotkey-when-hidden="{{vm.shortcutWhenHidden}}" ng-disabled="vm.disabled">
|
||||
<button ng-if="vm.type === 'submit'" type="submit" class="btn umb-button__button {{vm.style}} umb-button--{{vm.size}}" hotkey="{{vm.shortcut}}" hotkey-when-hidden="{{vm.shortcutWhenHidden}}" ng-disabled="vm.disabled" umb-auto-focus="{{vm.autoFocus && !vm.disabled ? 'true' : 'false'}}">
|
||||
<span class="umb-button__content" ng-class="{'-hidden': vm.innerState !== 'init'}">
|
||||
<i ng-if="vm.icon" class="{{vm.icon}} umb-button__icon"></i>
|
||||
{{vm.buttonLabel}}
|
||||
|
||||
@@ -50,7 +50,8 @@
|
||||
label="Confirm"
|
||||
type="button"
|
||||
disabled="!directive.enableConfirmButton"
|
||||
action="submitForm(model)">
|
||||
action="submitForm(model)"
|
||||
auto-focus="true">
|
||||
</umb-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -74,7 +75,8 @@
|
||||
type="button"
|
||||
disabled="model.disableSubmitButton"
|
||||
action="submitForm(model)"
|
||||
state="model.submitButtonState">
|
||||
state="model.submitButtonState"
|
||||
auto-focus="true">
|
||||
</umb-button>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user