UX: ensures esc key is correctly working when in dates form (#9299)
1 esc close modal focus date button in toolbar 2 esc reduces composer
This commit is contained in:
parent
d0d5f0c912
commit
6c2717eda0
|
@ -0,0 +1,21 @@
|
|||
import Controller from "@ember/controller";
|
||||
import ModalFunctionality from "discourse/mixins/modal-functionality";
|
||||
import { schedule } from "@ember/runloop";
|
||||
|
||||
export default Controller.extend(ModalFunctionality, {
|
||||
onShow() {
|
||||
schedule("afterRender", () => {
|
||||
const fromButton = document.getElementById("from-date-time");
|
||||
fromButton && fromButton.focus();
|
||||
});
|
||||
},
|
||||
|
||||
onClose() {
|
||||
schedule("afterRender", () => {
|
||||
const localDatesBtn = document.querySelector(
|
||||
".d-editor-button-bar .local-dates.btn"
|
||||
);
|
||||
localDatesBtn && localDatesBtn.focus();
|
||||
});
|
||||
}
|
||||
});
|
|
@ -23,6 +23,7 @@
|
|||
<div class="date-time-control from {{if fromSelected 'is-selected'}} {{if fromFilled 'is-filled'}}">
|
||||
{{d-icon "calendar-alt"}}
|
||||
{{d-button
|
||||
id="from-date-time"
|
||||
action=(action "focusFrom")
|
||||
translatedLabel=formattedFrom
|
||||
class="date-time"}}
|
||||
|
|
Loading…
Reference in New Issue