Skip to content

Commit

Permalink
🐛 fix(modal): input sans type bug dans le focus trap de la modale [DS…
Browse files Browse the repository at this point in the history
…-3831] (#992)

* Correction d'une erreur js liée au focus trap lorsqu'un champ de saisie n'a pas d'attribut "type" dans une modale
  • Loading branch information
keryanS authored Oct 23, 2024
1 parent e49ec50 commit c2d6959
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/component/input/input-base/example/sample/inputs.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ for (let i = 1; i < 4; i++) elements.push({
data: {
...input,
id: `${id}-${i}`,
name: `${id}`
name: `${id}-${i}`
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/component/modal/example/sample/body/form.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form action="">
<%- include("../../../../input/input-base/example/sample/inputs", {input: {group: true, id:'text'}}); %>
<%- include("../../../../input/input-base/example/sample/inputs", {inputs: {id:'input-sample'}}); %>
<%- include("../../../../button/example/sample/button-default", {button: {title: 'Envoyer'}}); %>
</form>
2 changes: 1 addition & 1 deletion src/component/modal/script/modal/focus-trap.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class FocusTrap {
}

unordereds = unordereds.filter((unordered) => {
if (unordered.tagName.toLowerCase() !== 'input' || unordered.getAttribute('type').toLowerCase() !== 'radio') return true;
if (unordered.tagName.toLowerCase() !== 'input' || unordered.getAttribute('type')?.toLowerCase() !== 'radio') return true;
const name = unordered.getAttribute('name');
return groups[name].keep(unordered);
});
Expand Down

0 comments on commit c2d6959

Please sign in to comment.