Skip to content

Commit

Permalink
fix: scroll error into view with nested key names (#904)
Browse files Browse the repository at this point in the history
* fix: scroll error into view with nested key names
  • Loading branch information
staffe authored Feb 23, 2023
1 parent 060a707 commit 5c192a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addon/components/validated-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default class ValidatedButtonComponent extends Component {
if (macroCondition(getOwnConfig().scrollErrorIntoView)) {
if (model.errors[0]?.key) {
document
.querySelector(`[name=${model.errors[0].key}]`)
.querySelector(`[name=${model.errors[0].key.replaceAll(".", "\\.")}]`)
?.scrollIntoView({ behavior: "smooth" });
}
}
Expand Down
4 changes: 3 additions & 1 deletion addon/components/validated-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export default class ValidatedFormComponent extends Component {
if (macroCondition(getOwnConfig().scrollErrorIntoView)) {
if (model.errors[0]?.key) {
document
.querySelector(`[name=${model.errors[0].key}]`)
.querySelector(
`[name=${model.errors[0].key.replaceAll(".", "\\.")}]`
)
?.scrollIntoView({ behavior: "smooth" });
}
}
Expand Down

0 comments on commit 5c192a5

Please sign in to comment.