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

Array modal's fields now keyboard accessible #4693

Merged
merged 9 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

### Fixes

* Registering duplicate icon is no longer breaking the build.
* Registering duplicate icon is no longer breaking the build.
* Field inputs inside an array modal can now be focused/tabbed via keyboard

### Adds

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ export default {
modal: {
active: false,
type: 'overlay',
showModal: false
showModal: false,
triggerFocusRefresh: 0
},
modalTitle: {
key: 'apostrophe:editType',
Expand Down Expand Up @@ -155,6 +156,7 @@ export default {
}
}
this.titleFieldChoices = await this.getTitleFieldChoices();
this.modal.triggerFocusRefresh++;
},
methods: {
setCurrentDoc(_id) {
Expand Down Expand Up @@ -199,6 +201,7 @@ export default {
this.next.push(item);
await this.select(item._id);
this.updateMinMax();
this.modal.triggerFocusRefresh++;
}
},
updateMinMax() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default {
// Returns true if the cancellation does occur
async confirmAndCancel() {
let dismiss;
if (this.isModified) {
const modified = typeof this.isModified === 'function' ? this.isModified() : this.isModified;
if (modified) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ValJed Unrelated to main pr, but i noticed array's isModified is a function, not a boolean. The bug it was causing was that array modals always acted as if they had been modified and threw a confirm when exiting a clean modal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wow nicely spotted, wouldn't it be a better solution to use a computed everywhere or a function ?

const discard = await apos.confirm({
heading: this.cancelHeading,
description: this.cancelDescription,
Expand Down
Loading