Skip to content

Commit

Permalink
Merge pull request #35 from simonihmig/immutable-options
Browse files Browse the repository at this point in the history
Make passed `focusTrapOptions` immutable
  • Loading branch information
josemarluedke authored May 26, 2021
2 parents 4bcb685 + c2760e5 commit 28e0be4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion addon/modifiers/focus-trap.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export default setModifierManager(
},
}
) {
state.focusTrapOptions = focusTrapOptions || {};
// treat the original focusTrapOptions as immutable, so do a shallow copy here
state.focusTrapOptions = { ...focusTrapOptions } || {};
if (typeof isActive !== 'undefined') {
state.isActive = isActive;
}
Expand Down

0 comments on commit 28e0be4

Please sign in to comment.