mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-03-30 05:43:55 +00:00
fix: escape CSS selector keys to handle special characters (#9030)
This commit is contained in:
parent
d377246491
commit
07dc8d8ce4
@ -69,7 +69,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
if (!props.current) return
|
if (!props.current) return
|
||||||
const key = props.key(props.current)
|
const key = props.key(props.current)
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
const element = scrollRef()?.querySelector(`[data-key="${key}"]`)
|
const element = scrollRef()?.querySelector(`[data-key="${CSS.escape(key)}"]`)
|
||||||
element?.scrollIntoView({ block: "center" })
|
element?.scrollIntoView({ block: "center" })
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -81,7 +81,7 @@ export function List<T>(props: ListProps<T> & { ref?: (ref: ListRef) => void })
|
|||||||
scrollRef()?.scrollTo(0, 0)
|
scrollRef()?.scrollTo(0, 0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const element = scrollRef()?.querySelector(`[data-key="${active()}"]`)
|
const element = scrollRef()?.querySelector(`[data-key="${CSS.escape(active()!)}"]`)
|
||||||
element?.scrollIntoView({ block: "center" })
|
element?.scrollIntoView({ block: "center" })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user