Minor Usability Bug on Formula Editor

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Minor Usability Bug on Formula Editor

Post by leoheck »

The Clear button on Formula editor does not work when it is selected and hit by the keyboard . It works when clicking with the mouse/trackpad.

How to reproduce

1. Click on any input field.
2. Hit '=' key to open the "Formula editor"
3. Type your value
4. Hit tab to select the first button (Clear)
5. Hit Enter to trigger the selected Clear button.

This should Clear the Formula edition but it is doing the same as the "Ok" button.

Edit: The button name is Clear no Cancel, sorry for this confusion.

OS: Ubuntu 21.04 (ubuntu:GNOME/ubuntu)
Word size of FreeCAD: 64-bit
Version: 0.20.
Build type: Release
Branch: unknown
Hash: fa057ca7d361530aa9d7399653c6977ec12c483c
Python version: 3.9.5
Qt version: 5.15.2
Coin version: 4.0.0
OCC version: 7.5.2
Locale: English/United States (en_US)
Last edited by leoheck on Fri Sep 03, 2021 2:11 pm, edited 2 times in total.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Minor Usability Bug on Formula Editor

Post by openBrain »

I'll have a look.
As a workaround, canceling with keyboard can be done IIRC with the 'Esc' key (and no need to focus on the right button). :)
kisolre
Veteran
Posts: 4166
Joined: Wed Nov 21, 2018 1:13 pm

Re: Minor Usability Bug on Formula Editor

Post by kisolre »

Shouldn't it be the "Space" key that needs to be pressed to act as a button press when a button is selected? If I remember correctly there are default confirm action (Enter key) and cancel action (ESC key) which are properties of any dialog regardless of its content. So which item is active should not matter since those are dialog hotkeys.
chrisb
Veteran
Posts: 54293
Joined: Tue Mar 17, 2015 9:14 am

Re: Minor Usability Bug on Formula Editor

Post by chrisb »

In Sketcher the escape key is used since years for canceling the currently active tool - add an element, add a constraint. When no tool is active the Sketcher is closed as you describe.
This is felt to be conflicting by people with a nervous finger or not trusting a ssiinnggllee key press who hit the escape key multiple times when they just want to end the tool.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Minor Usability Bug on Formula Editor

Post by openBrain »

Now I have access to a computer I have a better view.
Actually there is no "Cancel" button on the Expression dialog. This is a "Clear" button that purpose is to unbind expression.

Everything now seems correct from an UI/UX point of view :
* "Enter" means "Accept the dialog" => Pressing "Enter" -- wherever is the focus -- validate the dialog as if "Ok" was pressed
* @kisolre is perfectly right : to click on a focused button, the correct key to press is "Space"
* "Esc" leaves the dialog without making any modification (no button is associated with this)
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Minor Usability Bug on Formula Editor

Post by GeneFC »

I disagree.

I have never used the sequence under discussion, but when I just tried it I saw the same weird behavior.

I have used many hundreds of programs over many decades, and I use the tab to select "Cancel" (or clear or anything else) and the enter key to complete the operation in the selection. I have never ever used the space bar for such a thing.

In my immediate test the space bar worked exactly the same as the enter key, namely the changed value in the box was accepted, not cleared or canceled.

OS: Windows 7 Version 6.1 (Build 7601: SP 1)
Word size of FreeCAD: 64-bit
Version: 0.20.25541 (Git)
Build type: Release
Branch: master
Hash: ca043dcb6d20d70b8e24d75e810683214eecc5d4
Python version: 3.8.6+
Qt version: 5.15.2
Coin version: 4.0.1
OCC version: 7.5.0
Locale: English/United States (en_US)

[Edit: Even more fun with such boxes. They don't all work the same. The boxes used in the Path WB tasks act quite differently from the boxes in the main model tree. They look the same, but different click sequences are required to make a change in the entered value. Must be multiple options when setting these things up in the code. Perhaps Python vs. C++.]

Gene
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Minor Usability Bug on Formula Editor

Post by openBrain »

GeneFC wrote: Thu Sep 02, 2021 1:43 pm I disagree.
I have never used the sequence under discussion, but when I just tried it I saw the same weird behavior.
I have used many hundreds of programs over many decades, and I use the tab to select "Cancel" (or clear or anything else) and the enter key to complete the operation in the selection. I have never ever used the space bar for such a thing.
Listen to the wise. :) Maybe I was too fast. My thinking was "It is logical behavior according how it's coded". Probably you're right about UX.
In my immediate test the space bar worked exactly the same as the enter key, namely the changed value in the box was accepted, not cleared or canceled.
You should have miss something in your test because 'Space' works fine.

Anyway, I submitted a fix to have it working the way you and OP wants. It can't hurt : https://github.com/FreeCAD/FreeCAD/pull/5006

Notice the following : 'Ok' is still the default button, so 'Ok' will be transparently "clicked" when 'Enter' is pressed except if 'Clear' has the focus. In this latter case, 'Clear' will be "clicked" instead.
GeneFC
Veteran
Posts: 5373
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: Minor Usability Bug on Formula Editor

Post by GeneFC »

It is a bit ironic that I often chide new posters who demand that some feature works exactly like program XXX. :lol:

Gene
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Minor Usability Bug on Formula Editor

Post by leoheck »

kisolre wrote: Thu Sep 02, 2021 6:14 am Shouldn't it be the "Space" key that needs to be pressed to act as a button press when a button is selected?
"Esc key" - Cancels the Dialog. Closing it without changing anything. This is right.
"Ok Button" - Accepts a the Dialog, doing something. This is also working fine.
"Clear Button" - Cancels the dialog "removing" the formula. <--- This is what I wanted to trigger with the keyboard.

Now, the issue is that I cannot press the "Clear button" by hitting the "Enter key".
But it indeed work by pressing "Space key".

I did not know about this Space key to triggering the button. I just don't feel this is the standard trigger. I may be wrong.
Last edited by leoheck on Fri Sep 03, 2021 2:11 pm, edited 1 time in total.
leoheck
Veteran
Posts: 1225
Joined: Tue Mar 13, 2018 5:56 pm
Location: Coffee shop

Re: Minor Usability Bug on Formula Editor

Post by leoheck »

chrisb wrote: Thu Sep 02, 2021 7:33 am In Sketcher the escape key is used since years for canceling the currently active tool - add an element, add a constraint. When no tool is active the Sketcher is closed as you describe.
This is felt to be conflicting by people with a nervous finger or not trusting a ssiinnggllee key press who hit the escape key multiple times when they just want to end the tool.
See my previews reply for more information. I am not talking about leaving the dialog without doing anything. I am talking about leaving the dialog "removing' the formula.
Last edited by leoheck on Fri Sep 03, 2021 2:19 pm, edited 1 time in total.
Post Reply