Skip to content

Commit 667695b

Browse files
IndependentPanel: Replace nested button with div role=button
Avoid invalid nested <button> by using a focusable div with role=button. Preserves styling and click/keyboard behavior while preventing event bubbling issues and improving a11y in the chat list.
1 parent 8b7a3f9 commit 667695b

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/pages/IndependentPanel/App.jsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,14 +232,22 @@ function App() {
232232
{filteredSessions
233233
.filter((session) => Boolean(session.sessionId))
234234
.map((session) => (
235-
<button
235+
<div
236236
key={session.sessionId}
237+
role="button"
238+
tabIndex={0}
237239
className={`normal-button chat-list-item ${
238240
sessionId === session.sessionId ? 'active' : ''
239241
}`}
240242
onClick={() => {
241243
setSessionIdSafe(session.sessionId)
242244
}}
245+
onKeyDown={(e) => {
246+
if (e.key === 'Enter' || e.key === ' ') {
247+
e.preventDefault()
248+
setSessionIdSafe(session.sessionId)
249+
}
250+
}}
243251
>
244252
{session.sessionName}
245253
<span
@@ -280,7 +288,7 @@ function App() {
280288
}}
281289
/>
282290
</span>
283-
</button>
291+
</div>
284292
))}
285293
</div>
286294
<hr />

0 commit comments

Comments
 (0)