Skip to content

Commit dd8075b

Browse files
Replace outer session button with role=button div
Avoid nested buttons by converting the session list item container to a focusable div with role=button and keyboard handlers (Enter/Space). This preserves styling and a11y while eliminating invalid HTML nesting. Validated via prettier, lint, and build.
1 parent 7a777b6 commit dd8075b

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/pages/IndependentPanel/App.jsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,9 @@ function App() {
249249
.filter((session) => Boolean(session.sessionId))
250250
.map((session) => (
251251
<div role="listitem" key={session.sessionId}>
252-
<button
253-
type="button"
252+
<div
253+
role="button"
254+
tabIndex={0}
254255
aria-pressed={sessionId === session.sessionId}
255256
aria-current={sessionId === session.sessionId ? 'true' : undefined}
256257
className={`normal-button chat-list-item ${
@@ -259,6 +260,12 @@ function App() {
259260
onClick={() => {
260261
setSessionIdSafe(session.sessionId)
261262
}}
263+
onKeyDown={(e) => {
264+
if (e.key === 'Enter' || e.key === ' ') {
265+
e.preventDefault()
266+
setSessionIdSafe(session.sessionId)
267+
}
268+
}}
262269
>
263270
{session.sessionName}
264271
<span
@@ -298,7 +305,7 @@ function App() {
298305
}}
299306
/>
300307
</span>
301-
</button>
308+
</div>
302309
</div>
303310
))}
304311
</div>

0 commit comments

Comments
 (0)