|
119 | 119 | root.id = 'tutorChatRoot'; |
120 | 120 | root.className = 'tutor-chat'; |
121 | 121 | root.innerHTML = ` |
122 | | - <button class="tutor-chat__fab" id="tutorChatFab" aria-label="Open tutor chat" aria-expanded="false" aria-controls="tutorChatPanel"> |
| 122 | + <button type="button" class="tutor-chat__fab" id="tutorChatFab" aria-label="Open tutor chat" aria-expanded="false" aria-controls="tutorChatPanel"> |
123 | 123 | <svg viewBox="0 0 24 24" width="20" height="20" aria-hidden="true"> |
124 | 124 | <path d="M5 5h14a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H9l-4 4V7a2 2 0 0 1 2-2Z" |
125 | 125 | fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/> |
|
134 | 134 | <h2 class="tutor-chat__title">Ask about Python</h2> |
135 | 135 | <p class="tutor-chat__sub" id="tutorChatSub">Connecting…</p> |
136 | 136 | </div> |
137 | | - <button class="tutor-chat__close" id="tutorChatClose" aria-label="Close tutor chat"> |
138 | | - <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true"> |
| 137 | + <button type="button" class="tutor-chat__close" id="tutorChatClose" aria-label="Close tutor chat" title="Close tutor chat"> |
| 138 | + <svg viewBox="0 0 24 24" width="18" height="18" aria-hidden="true" focusable="false" pointer-events="none"> |
139 | 139 | <path d="M6 6l12 12M18 6L6 18" stroke="currentColor" stroke-width="2" stroke-linecap="round"/> |
140 | 140 | </svg> |
141 | 141 | </button> |
|
174 | 174 | const banner = root.querySelector('#tutorChatBanner'); |
175 | 175 | const sendBtn = root.querySelector('#tutorChatSend'); |
176 | 176 |
|
177 | | - fab.addEventListener('click', () => toggle(true, { panel, fab, input })); |
178 | | - closeBtn.addEventListener('click', () => toggle(false, { panel, fab, input })); |
| 177 | + fab.addEventListener('click', (e) => { |
| 178 | + e.preventDefault(); |
| 179 | + toggle(true, { panel, fab, input }); |
| 180 | + }); |
| 181 | + closeBtn.addEventListener('click', (e) => { |
| 182 | + e.preventDefault(); |
| 183 | + e.stopPropagation(); |
| 184 | + toggle(false, { panel, fab, input }); |
| 185 | + }); |
179 | 186 | resetBtn.addEventListener('click', () => { |
180 | 187 | state.history = []; |
181 | 188 | renderLog(log); |
|
0 commit comments