Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V8: Add auto-focus to the default action in overlay dialogs #5463

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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: "@?"
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ angular.module("umbraco.directives")
}
};

$timeout(function() {
update();
});
if (attr.umbAutoFocus !== "false") {
$timeout(function() {
update();
});
}
};
});
Original file line number Diff line number Diff line change
Expand Up @@ -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) {


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
</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}}
<span ng-if="vm.showCaret" class="umb-button__caret caret"></span>
</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}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ <h5 class="red" ng-if="model.confirmSubmit.title"><i class="icon-alert"></i> {{
label="Confirm"
type="button"
disabled="!directive.enableConfirmButton"
action="submitForm(model)">
action="submitForm(model)"
auto-focus="true">
</umb-button>
</div>
</div>
Expand All @@ -74,7 +75,8 @@ <h5 class="red" ng-if="model.confirmSubmit.title"><i class="icon-alert"></i> {{
type="button"
disabled="model.disableSubmitButton"
action="submitForm(model)"
state="model.submitButtonState">
state="model.submitButtonState"
auto-focus="true">
</umb-button>
</div>

Expand Down