mirror of
https://github.com/linsa-io/linsa.git
synced 2026-01-12 12:20:23 +01:00
fix(link): Keybind, scroll behaviour, restrict drag to vertical (#176)
* chore: expose scrollActiveElementIntoView * feat(utils): editable element * fix: memoize exceptionRefs, use animation frame and check editable element * fix: improve btn on mobile * chore(drps): bump framer motion version * fix(link): big fix * chore: remove comment code * feat: touch device
This commit is contained in:
@@ -34,6 +34,24 @@ export function shuffleArray<T>(array: T[]): T[] {
|
||||
return shuffled
|
||||
}
|
||||
|
||||
export const isEditableElement = (element: HTMLElement): boolean => {
|
||||
if (element.isContentEditable) {
|
||||
return true
|
||||
}
|
||||
|
||||
const tagName = element.tagName.toLowerCase()
|
||||
const editableTags = ["input", "textarea", "select", "option"]
|
||||
|
||||
if (editableTags.includes(tagName)) {
|
||||
return true
|
||||
}
|
||||
|
||||
const role = element.getAttribute("role")
|
||||
const editableRoles = ["textbox", "combobox", "listbox"]
|
||||
|
||||
return role ? editableRoles.includes(role) : false
|
||||
}
|
||||
|
||||
export * from "./urls"
|
||||
export * from "./slug"
|
||||
export * from "./keyboard"
|
||||
|
||||
Reference in New Issue
Block a user