Skip to content

Commit

Permalink
Fix widget Editor focus and cross modal focusing
Browse files Browse the repository at this point in the history
  • Loading branch information
myovchev committed Nov 21, 2024
1 parent d3fd291 commit 866333f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -429,11 +429,11 @@ export default {
},
attachKeyboardFocusHandler() {
this.$refs.wrapper.addEventListener('keydown', this.handleKeyboardFocus);
this.$refs.wrapper?.addEventListener('keydown', this.handleKeyboardFocus);
},
removeKeyboardFocusHandler() {
this.$refs.wrapper.removeEventListener('keydown', this.handleKeyboardFocus);
this.$refs.wrapper?.removeEventListener('keydown', this.handleKeyboardFocus);
},
// Focus parent, useful for obtrusive UI
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
aria-modal="true"
:aria-labelledby="props.modalData.id"
data-apos-modal
@focus.capture="storeFocusedElement"
@focus.capture="captureFocus"
@esc="close"
@keydown.tab="onTab"
>
Expand Down Expand Up @@ -264,6 +264,11 @@ function onLeave() {
emit('no-modal');
}
function captureFocus(e) {
storeFocusedElement(e);
store.updateModalData(props.modalData.id, { focusedElement: e.target });
}
async function trapFocus() {
if (modalEl?.value) {
const elementSelectors = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
/>
<AposButton
type="primary"
data-apos-focus-priority
:label="saveLabel"
:disabled="errorCount > 0"
@click="save"
Expand Down

0 comments on commit 866333f

Please sign in to comment.