Skip to content

Add disabled check to btn_key_down() in button.v - #629

Merged
metif12 merged 2 commits into
vlang:masterfrom
lq259:disabled-check
Nov 21, 2026
Merged

metif12 merged 2 commits into
vlang:masterfrom
lq259:disabled-check

Conversation

@lq259

@lq259 lq259 commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Add a check for the button being disabled along with the check for hidden buttons.

@metif12 metif12 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes.

The code doesn't match the PR title. The title says "Add disabled check to btn_key_down()", but the diff changes btn_mouse_down() (line 294); btn_key_down() still only checks b.hidden.

Consequences worth clarifying before merge:

  • If the goal is that disabled buttons ignore input, the keyboard path is still unguarded: btn_key_down() calls on_click on Enter/Space with no disabled check, so a focused-then-disabled button can still be activated. btn_click() already guards hidden || disabled, which makes this gap stand out.
  • btn_mouse_up() and btn_mouse_move() also still only check hidden, so hover state and mouse-up callbacks still fire for disabled buttons.
  • Branch is 1 commit behind master; please rebase. No CI checks are reported on the PR.

Could you confirm which function you intended? Most likely the fix belongs in btn_key_down() (and ideally btn_mouse_up() / btn_mouse_move() too for consistency). Happy to re-review once updated.

Guard btn_key_down, btn_mouse_up and btn_mouse_move with the same disabled check already used by btn_click and btn_mouse_down, so a disabled button cannot be activated by keyboard or produce hover/mouse-up callbacks.
@metif12
metif12 merged commit 892984f into vlang:master Nov 21, 2026
1 of 5 checks passed
@lq259

lq259 commented Nov 21, 2026

Copy link
Copy Markdown
Contributor Author

im sorry; i made this PR awhile ago and i honestly had no clue what i was doing. low quality PRs like this are generally destructive... anyways thank you for your tolerance :)

@metif12

metif12 commented Nov 22, 2026

Copy link
Copy Markdown
Member

im sorry; i made this PR awhile ago and i honestly had no clue what i was doing. low quality PRs like this are generally destructive... anyways thank you for your tolerance :)

Dont be sorry, all help are welcome and your pr was just ok. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants