Ignore disabled buttons on default hint mode

You can still click them if you use non-default hint modes
which I think is probably what users expect
This commit is contained in:
Oliver Blanthorn 2026-07-21 18:26:31 +02:00
parent 649a77962a
commit 6dade7d1fb
No known key found for this signature in database
GPG key ID: 2BB8C36BB504BFF3
2 changed files with 13 additions and 2 deletions

View file

@ -86,6 +86,10 @@ function isEditableHTMLInput(element: HTMLInputElement) {
return false
}
export function isWithinDisabledFormControl(element: Element): boolean {
return element.closest(":disabled:not(fieldset)") !== null
}
/**
* Dispatch a mouse event to the target element
* based on cVim's implementation

View file

@ -414,12 +414,19 @@ export class HintConfig implements HintOptions {
hinting.saveableElements(this.includeInvisible),
)
default:
return hinting.hintables(
default: {
const hintables = await hinting.hintables(
DOM.HINTTAGS_selectors,
this.jshints,
this.includeInvisible,
)
for (const hintable of hintables) {
hintable.elements = hintable.elements.filter(
element => !DOM.isWithinDisabledFormControl(element),
)
}
return hintables
}
}
}