Repository navigation
Add disabled check to btn_key_down() in button.v - #629
Conversation
metif12
left a comment
There was a problem hiding this comment.
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()callson_clickon Enter/Space with nodisabledcheck, so a focused-then-disabled button can still be activated.btn_click()already guardshidden || disabled, which makes this gap stand out. btn_mouse_up()andbtn_mouse_move()also still only checkhidden, 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.
|
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. |
Add a check for the button being disabled along with the check for hidden buttons.