Skip to content

Commit a96b203

Browse files
Make list semantics explicit: role=list with role=listitem wrappers and aria-current
Wrap each chat item in a role=listitem container to match role=list on the parent; add aria-current on the active item for better screen reader feedback. Build and lint pass.
1 parent cb844af commit a96b203

File tree

1 file changed

+38
-36
lines changed

1 file changed

+38
-36
lines changed

src/pages/IndependentPanel/App.jsx

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -248,45 +248,47 @@ function App() {
248248
{filteredSessions
249249
.filter((session) => Boolean(session.sessionId))
250250
.map((session) => (
251-
<button
252-
type="button"
253-
key={session.sessionId}
254-
aria-pressed={sessionId === session.sessionId}
255-
className={`normal-button chat-list-item ${
256-
sessionId === session.sessionId ? 'active' : ''
257-
}`}
258-
onClick={() => {
259-
setSessionIdSafe(session.sessionId)
260-
}}
261-
>
262-
{session.sessionName}
263-
<span className="gpt-util-group">
264-
<DeleteButton
265-
size={14}
266-
text={t('Delete Conversation')}
267-
onConfirm={async () => {
268-
const deletedId = session.sessionId
269-
const updatedSessions = await deleteSession(deletedId)
270-
setSessions(updatedSessions)
271-
if (!updatedSessions || updatedSessions.length === 0) {
272-
setSessionId(null)
273-
setCurrentSession(null)
274-
return
275-
}
276-
// Only change active session if the deleted one was active
277-
if (sessionId === deletedId) {
278-
const next = updatedSessions.find((s) => s && s.sessionId)
279-
if (next) {
280-
await setSessionIdSafe(next.sessionId)
281-
} else {
251+
<div role="listitem" key={session.sessionId}>
252+
<button
253+
type="button"
254+
aria-pressed={sessionId === session.sessionId}
255+
aria-current={sessionId === session.sessionId ? 'true' : undefined}
256+
className={`normal-button chat-list-item ${
257+
sessionId === session.sessionId ? 'active' : ''
258+
}`}
259+
onClick={() => {
260+
setSessionIdSafe(session.sessionId)
261+
}}
262+
>
263+
{session.sessionName}
264+
<span className="gpt-util-group">
265+
<DeleteButton
266+
size={14}
267+
text={t('Delete Conversation')}
268+
onConfirm={async () => {
269+
const deletedId = session.sessionId
270+
const updatedSessions = await deleteSession(deletedId)
271+
setSessions(updatedSessions)
272+
if (!updatedSessions || updatedSessions.length === 0) {
282273
setSessionId(null)
283274
setCurrentSession(null)
275+
return
284276
}
285-
}
286-
}}
287-
/>
288-
</span>
289-
</button>
277+
// Only change active session if the deleted one was active
278+
if (sessionId === deletedId) {
279+
const next = updatedSessions.find((s) => s && s.sessionId)
280+
if (next) {
281+
await setSessionIdSafe(next.sessionId)
282+
} else {
283+
setSessionId(null)
284+
setCurrentSession(null)
285+
}
286+
}
287+
}}
288+
/>
289+
</span>
290+
</button>
291+
</div>
290292
))}
291293
</div>
292294
<hr />

0 commit comments

Comments
 (0)