Commit 39cf0ed
fix: protect directive not revealing when wrapping tabs
The protect client.js used getElementsByTagName('input')[0] to find
the password input, which grabbed the first input in the entire subtree.
When protect wrapped tabs, this selected a tab radio input instead of
the password input, so event listeners were attached to the wrong
element and password entry was silently ignored.
Scope both selectors to direct children using :scope queries:
- Input: el.querySelector(':scope > .password-input input')
- Hidden: el.querySelector(':scope > .hidden')
Co-authored-by: Copilot <[email protected]>1 parent 841cf31 commit 39cf0ed
3 files changed
Lines changed: 19 additions & 2 deletions
File tree
- .changeset
- packages/markdown/assets/directive-protect
- website/en/book
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
| |||
0 commit comments