Spiegel von
https://github.com/paviliondev/discourse-custom-wizard.git
synchronisiert 2024-11-22 09:20:29 +01:00
COMPATIBILITY: core autofocus does not work with custom wizard DOM structure
Dieser Commit ist enthalten in:
Ursprung
4edb40e526
Commit
ac15ed8983
1 geänderte Dateien mit 16 neuen und 1 gelöschten Zeilen
|
@ -10,6 +10,7 @@ export default {
|
|||
const getUrl = requirejs("discourse-common/lib/get-url").default;
|
||||
const discourseComputed = requirejs("discourse-common/utils/decorators").default;
|
||||
const cook = requirejs("discourse/plugins/discourse-custom-wizard/wizard/lib/text-lite").cook;
|
||||
const { schedule } = requirejs("@ember/runloop");
|
||||
|
||||
StepModel.reopen({
|
||||
save() {
|
||||
|
@ -72,8 +73,22 @@ export default {
|
|||
StepComponent.reopen({
|
||||
classNameBindings: ["step.id"],
|
||||
|
||||
autoFocus() {
|
||||
schedule("afterRender", () => {
|
||||
const $invalid = $(
|
||||
".wizard-field.invalid:nth-of-type(1) .wizard-focusable"
|
||||
);
|
||||
|
||||
if ($invalid.length) {
|
||||
return $invalid.focus();
|
||||
}
|
||||
|
||||
$(".wizard-focusable:first").focus();
|
||||
});
|
||||
},
|
||||
|
||||
animateInvalidFields() {
|
||||
Ember.run.scheduleOnce("afterRender", () => {
|
||||
schedule("afterRender", () => {
|
||||
let $element = $(".invalid input[type=text],.invalid textarea,.invalid input[type=checkbox],.invalid .select-kit");
|
||||
|
||||
if ($element.length) {
|
||||
|
|
Laden …
In neuem Issue referenzieren