UI: Replace UI_ACTIVE with UI_HOVER #112160

Open
opened 2023-09-08 20:22:21 +02:00 by Harley Acheson · 3 comments
Member

UI items that are actively hovered are given a UI_ACTIVE flag so that they can shown highlighted. This is a confusing name for this state, and most people would not guess this means hover. We also use the term "Inactive" in our flags (UI_BUT_INACTIVE) with an entirely different meaning. So a button can be both inactive and active, with different meanings.

I think we should move toward a more standard definition of states. Probably taken from HTML since their terms are well-researched. So "Hover" would be used to indicate the state of having a mouse over the item. "Active" would indicate that an item is being directly acted upon, like a button that would be shown as depressed because you are clicking on it right now.

The first step of cleaning this up would be renaming UI_ACTIVE and its uses. There are some functions that should also be renamed, but others not. One that changes colors based on this should use "hover", but we also have functions that "activate" buttons and these usages are correct. So changes must be done carefully.

UI items that are actively hovered are given a UI_ACTIVE flag so that they can shown highlighted. This is a confusing name for this state, and most people would not guess this means hover. We also use the term "Inactive" in our flags (UI_BUT_INACTIVE) with an entirely different meaning. So a button can be both inactive and active, with different meanings. I think we should move toward a more standard definition of states. Probably taken from HTML since their terms are well-researched. So "Hover" would be used to indicate the state of having a mouse over the item. "Active" would indicate that an item is being directly acted upon, like a button that would be shown as depressed because you are clicking on it right now. The first step of cleaning this up would be renaming UI_ACTIVE and its uses. There are some functions that should also be renamed, but others not. One that changes colors based on this should use "hover", but we also have functions that "activate" buttons and these usages are correct. So changes must be done carefully.
Harley Acheson added the
Type
Design
label 2023-09-08 20:22:21 +02:00
Harley Acheson added this to the User Interface project 2023-09-08 20:22:22 +02:00
Member

UI_ACTIVE should indeed be named UI_HOVER (or better UI_BUT_HOVER/UI_BUT_HOVERED?), this has been noted and agreed on a few times in the past, we just never actually made the change. This is a simple first step, let's do it.

Think UI_SELECTED could/should be UI_ACTIVE but changing that can cause confusion with the other uses of "active". Also code comments may still refer to what's now called hover and may be misleading then. It's a bit tricky to make this transition. All things considered I think this should be called UI_PUSHED (or UI_BUT_PUSHED) instead.

UI handling code uses the word "active" but it's a bit ambiguous too, since it involves both the hovered and the UI_SELECTED/UI_PUSHED state and potentially others. I suggest we consider this state "focused" instead. In blender hovering a button can mean that it becomes focused, this makes sense to me.

`UI_ACTIVE` should indeed be named `UI_HOVER` (or better `UI_BUT_HOVER`/`UI_BUT_HOVERED`?), this has been noted and agreed on a few times in the past, we just never actually made the change. This is a simple first step, let's do it. Think `UI_SELECTED` could/should be `UI_ACTIVE` but changing that can cause confusion with the other uses of "active". Also code comments may still refer to what's now called hover and may be misleading then. It's a bit tricky to make this transition. All things considered I think this should be called `UI_PUSHED` (or `UI_BUT_PUSHED`) instead. UI handling code uses the word "active" but it's a bit ambiguous too, since it involves both the hovered and the `UI_SELECTED`/`UI_PUSHED` state and potentially others. I suggest we consider this state "focused" instead. In blender hovering a button can mean that it becomes focused, this makes sense to me.
Member

Thinking further about this, I think UI_HOVER_FOCUS is a reasonably good name. PR: #114113

Adding the term "focus" seems important because the button will receive events and shortcuts, a rather unique Blender feature. Otherwise the flag seems too much like a drawing flag, but it actually makes a button "active" for the event handling. Plus sometimes we set the flag for buttons to be focused, without actually mouse hovering it. Lastly a button may be hovered but not highlighted/focused/active because another (modal) handler is blocking it. I'd still include the term "hovered" since this is an important hint.

Interestingly, I found this new terminology helped me think more clear about some existing code and find potential improvements :)


Updated terminology proposal:

  • UI_ACTIVE -> UI_HOVER_FOCUS: See above.
  • UI_SELECTED -> UI_PUSHED: See previous comment. Or: UI_PUSHED_FOCUS?

Handling code can keep the term "active" for the button it sends input to, this seems reasonable. But we could also rename it to focus (if we go with UI_HOVER_FOCUS & UI_PUSHED_FOCUS?).

Thinking further about this, I think `UI_HOVER_FOCUS` is a reasonably good name. PR: #114113 Adding the term "focus" seems important because the button will receive events and shortcuts, a rather unique Blender feature. Otherwise the flag seems too much like a drawing flag, but it actually makes a button "active" for the event handling. Plus sometimes we set the flag for buttons to be focused, without actually mouse hovering it. Lastly a button may be hovered but not highlighted/focused/active because another (modal) handler is blocking it. I'd still include the term "hovered" since this is an important hint. Interestingly, I found this new terminology helped me think more clear about some existing code and find potential improvements :) --- Updated terminology proposal: - `UI_ACTIVE` -> `UI_HOVER_FOCUS`: See above. - `UI_SELECTED` -> `UI_PUSHED`: See previous comment. Or: `UI_PUSHED_FOCUS`? Handling code can keep the term "active" for the button it sends input to, this seems reasonable. But we could also rename it to focus (if we go with `UI_HOVER_FOCUS` & `UI_PUSHED_FOCUS`?).
Author
Member

Although we don’t deal with this state much now, I’d prefer to keep a separate “focus” state, the single item that would receive keyboard input. In most applications we not only enter this state by clicking on an input field, but change the focused item with the Tab key. In Blender we do indicate this state for text inputs but we should do so for others. For example press Tab to move to the next item which is a checkbox, which changes in some visible way to indicate focus, press space bar to toggle its state, then hit Tab to move to the next.

Similarly, close Blender with unsaved changes and we get a dialog. We could better show the current “default” button with focus indication (usually an outline), then you could Tab between the buttons and press Enter.

Another thing I’d love to separately support is a (proper) “Active”. The item in this state is currently being actively acted upon. Typically this is the “Down” position of a button when you are depressing it. Checkboxes might show an inbetween state. It helps interfaces feel a bit more alive and responsive. It also visually explains the behaviour when you click to depress a button, but the drag out of it before releasing, therefore cancelling the action.

Together you might press Tab to move focus to an item. Move your mouse over another item and it gets “hover” while the first is still “focus”. Press down on your mouse and the new item gets focus and active. Release the mouse button and active is removed but focus remains there.

Although we don’t deal with this state much now, I’d prefer to keep a separate “focus” state, the single item that would receive keyboard input. In most applications we not only enter this state by clicking on an input field, but change the focused item with the Tab key. In Blender we do indicate this state for text inputs but we should do so for others. For example press Tab to move to the next item which is a checkbox, which changes in some visible way to indicate focus, press space bar to toggle its state, then hit Tab to move to the next. Similarly, close Blender with unsaved changes and we get a dialog. We could better show the current “default” button with focus indication (usually an outline), then you could Tab between the buttons and press Enter. Another thing I’d love to separately support is a (proper) “Active”. The item in this state is currently being actively acted upon. Typically this is the “Down” position of a button when you are depressing it. Checkboxes might show an inbetween state. It helps interfaces feel a bit more alive and responsive. It also visually explains the behaviour when you click to depress a button, but the drag out of it before releasing, therefore cancelling the action. Together you might press Tab to move focus to an item. Move your mouse over another item and it gets “hover” while the first is still “focus”. Press down on your mouse and the new item gets focus and active. Release the mouse button and active is removed but focus remains there.
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#112160
No description provided.