zaproxy / zaproxy

The ZAP by Checkmarx Core project
https://www.zaproxy.org
Apache License 2.0
12.59k stars 2.25k forks source link

Default focus for dialogs with a tab row #7084

Open tspearconquest opened 2 years ago

tspearconquest commented 2 years ago

Is your feature request related to a problem? Please describe. When opening dialogs in ZAP Desktop, I've found that if there is a row of tabs at the top of the dialog, the default focus seems to be on that row of tabs instead of the contents of the selected tab.

This causes an extra click to be required in some cases, such as the Environment dialog in the Automation Framework, before interacting with certain elements of the dialog.

In the default setup in a new session, this dialog has just a single context, the Default Context, in a table row in a table in the Contexts tab. But the tab itself is focused instead of the Default Context table row being selected and in focus. And yet the Modify button on the right is enabled despite nothing being selected in the table.

Arguably, the Modify button being enabled may be a bug with the Environment dialog because the Modify button shouldn't be enabled if the table's selection is null, but I opened this as a feature request because this seems to be the default for tabbed dialogs across the ZAP Desktop GUI since I also found the same behavior in the Marketplace dialog -- the tab row is focused by default when dialogs are opened for the first time.

Describe the solution you'd like For the Automation Framework's Environment dialog, the default focus should be on the table in the Contexts tab, and the first row in the table should be selected when the dialog is opened for the first time in a new session.

In the case of the Marketplace, the default focus should be on the Check for Updates button if it is present, or on the Filter text box if the Check for Updates button is not present.

Describe alternatives you've considered n/a

Additional context Automation Framework - Environment dialog, brand new session, tab row focused instead of Default Context image

tspearconquest commented 2 years ago

I did a bunch of other testing but felt it might make the OP too long.

  1. In the Marketplace, if the tab row is focused and a user clicks on the Marketplace tab, then clicks back to the Installed tab, the tab row remains focused.

    • Conversely, if a user clicks somewhere in the Installed tab first, then clicks on the Marketplace tab, the Check for Updates button becomes the focus, and upon clicking back to the Installed tab, the Check for Updates button remains the focus.
    • If the Check for Updates button has been clicked, and therefore removed from the GUI, then switching between the tabs puts the focus on the Filter text box in either tab, not back on the tabs and not back on the last focused item which might be a row in the list of addons.
  2. In the Automation Framework Environment dialog, clicking on either of the Parameters or Variables tabs and then back on the Contexts tab keeps the tab row in focus the same as the Marketplace dialog.

    • As mentioned, the Modify button shouldn't be enabled when there is no selection. Going hand in hand with that, I think users shouldn't be able to "unselect" by control+click (PC) or command+click (Mac) after they've selected one row, nor select multiple rows.
      • Maybe it would be ok with multiple rows being selected if the Remove button didn't get disabled by having multiple rows selected...
    • When switching to the Parameters tab and clicking one of the checkboxes there, then switching back to the Contexts tab, the focus appears to remain on the last checked checkbox from the Parameters tab. It should instead go to the last selected row if one was selected, or the first row if the table has 1 or more rows, or the Add button if the table has no rows.
    • If a user goes back to the Parameters tab while a row is selected in the Contexts tab, then clicks the middle or bottom checkbox, then switches back to the Contexts tab, and then back to the Parameters tab, the top checkbox is the one which ends up with focus, instead of the last clicked checkbox.
    • In the Variables tab which has nothing by default in the table, the Modify button should be disabled when there is no selection.