Skip to content

Commit 85cb236

Browse files
committed
fix: decrease what we expose
1 parent e4fcefc commit 85cb236

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

app/components/Button/Base.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const el = useTemplateRef('el')
2525
2626
defineExpose({
2727
focus: () => el.value?.focus(),
28-
buttonRef: el,
28+
getBoundingClientRect: () => el.value?.getBoundingClientRect(),
2929
})
3030
</script>
3131

app/components/ReadmeTocDropdown.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ function toggle() {
7979
if (isOpen.value) {
8080
close()
8181
} else {
82-
if (triggerRef.value?.buttonRef) {
83-
const rect = triggerRef.value.buttonRef.getBoundingClientRect()
82+
const rect = triggerRef.value?.getBoundingClientRect()
83+
if (rect) {
8484
dropdownPosition.value = {
8585
top: rect.bottom + 4,
8686
right: rect.right,
@@ -101,7 +101,7 @@ function close() {
101101
function select(id: string) {
102102
scrollToAnchor(id, { scrollFn: props.scrollToHeading })
103103
close()
104-
triggerRef.value?.buttonRef?.focus()
104+
triggerRef.value?.focus()
105105
}
106106
107107
function getIndex(id: string): number {
@@ -138,7 +138,7 @@ function handleKeydown(event: KeyboardEvent) {
138138
}
139139
case 'Escape':
140140
close()
141-
triggerRef.value?.buttonRef?.focus()
141+
triggerRef.value?.focus()
142142
break
143143
}
144144
}

0 commit comments

Comments
 (0)