Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): improve "Add Tag" ux #784

Merged
merged 15 commits into from
Feb 4, 2025
Merged

fix(ui): improve "Add Tag" ux #784

merged 15 commits into from
Feb 4, 2025

Conversation

CyanVoxel
Copy link
Member

@CyanVoxel CyanVoxel commented Feb 3, 2025

Summary

This PR makes several tweaks and changes to improve the tagging user experience. Since these were fixing lots of small bugs and issues, I decided not to open up any additional bug reports as it would take less time to fix these than it would be to open up reports for all of them.

Fixes & Changes

  • Reset tag search box and focus each time a tag search panel is opened
  • Include tag parents in tag search results (v9.4 parity)
  • Lowercase tag names now get properly sorted with uppercase ones (bug mentioned in Tags are no longer organized by color. #771)
  • The "use for disambiguation" button has been moved to the right-hand side of parent tags in order to prevent accidental clicks involving the left-hand "remove tag" button
  • Don't include tag display names in "closeness" factor when searching
  • Add "Create & Add" button to the bottom of all non-whitespace searches, even if they return some tags
  • Escape "&" characters inside tag names so Qt doesn't treat them as mnemonics
  • (This was initially relevant to this PR) Make imports of datetime consistent
  • The awkward "+" button next to tags in the "Add Tags" panel has been removed in favor of clicking on tags themselves
  • Highlighting, keyboard focusing, and clicking tags has improved visual feedback
  • The clickable area of the "-" button on tags has been increased and has visual feedback when you hover and click it
  • Set minimum tag width
  • You can now tab into the tag search list and add tags with a spacebar press (previously possible but very janky)
  • In tag search panels, pressing the Esc key will return your focus to the search bar and highlight your previous query. If the search box is already highlighted, pressing Esc will close the modal
  • In modals such as the "Add Tag" and "Edit Tag" panels, pressing Esc will cancel the operation and close the modal
  • Fix "Add Tags" panel missing its window title when accessing from the keyboard shortcut
  • Add Ctrl+M shortcut to open up the "Tag Manager"

@CyanVoxel CyanVoxel added Type: Bug Something isn't working as intended Type: Enhancement New feature or request Type: Refactor Code that needs to be restructured or cleaned up Type: QoL A quality of life (QoL) enhancement or suggestion Type: UI/UX User interface and/or user experience labels Feb 3, 2025
@CyanVoxel CyanVoxel added this to the SQL Parity milestone Feb 3, 2025
@CyanVoxel CyanVoxel marked this pull request as draft February 3, 2025 07:36
@Tishj
Copy link

Tishj commented Feb 3, 2025

I had a recent UX thought on the "Create & Add" workflow, sometimes you'll type the tag name wrong, hitting enter brings up the create tag window. It would be great if hitting Esc in that case closes the create tag window and puts highlight back on the search input field

Want me to make a separate issue for that or is it small enough to incorporate in this PR?

@Tishj
Copy link

Tishj commented Feb 3, 2025

Include tag parents in tag search results (v9.4 parity)

This messes with the result order, child tags could show up before the parent tag, even if the tag is fully spelled out in the search

@CyanVoxel
Copy link
Member Author

Include tag parents in tag search results (v9.4 parity)

This messes with the result order, child tags could show up before the parent tag, even if the tag is fully spelled out in the search

Don't worry, I noticed that too with a few tags and drafted this. My current plan is to split the results up by "priority" on the search_tags side of library.py instead of having the UI try and untangle a single results set. This should be slightly more performant and give a lot more granular control over how results are returned, too

@CyanVoxel CyanVoxel marked this pull request as ready for review February 3, 2025 23:33
@CyanVoxel CyanVoxel merged commit dbf7353 into main Feb 4, 2025
10 checks passed
@CyanVoxel CyanVoxel deleted the fix-tag-ux branch February 4, 2025 00:15
@Tishj
Copy link

Tishj commented Feb 4, 2025

Looks great!

It looks like you missed one though, I added this to the PanelWidget to make it respond to Esc

diff --git a/tagstudio/src/qt/widgets/panel.py b/tagstudio/src/qt/widgets/panel.py
index 141849b..2e22fb0 100755
--- a/tagstudio/src/qt/widgets/panel.py
+++ b/tagstudio/src/qt/widgets/panel.py
@@ -95,6 +95,11 @@ class PanelModal(QWidget):
         self.root_layout.addWidget(self.button_container)
         widget.parent_post_init()

+    def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:  # noqa N802
+        if event.key() == QtCore.Qt.Key.Key_Escape:
+            self.close()
+        return super().keyPressEvent(event)
+
     def closeEvent(self, event):  # noqa: N802
         self.done_button.click()
         event.accept()

@CyanVoxel
Copy link
Member Author

CyanVoxel commented Feb 4, 2025

Looks great!

It looks like you missed one though, I added this to the PanelWidget to make it respond to Esc

diff --git a/tagstudio/src/qt/widgets/panel.py b/tagstudio/src/qt/widgets/panel.py
index 141849b..2e22fb0 100755
--- a/tagstudio/src/qt/widgets/panel.py
+++ b/tagstudio/src/qt/widgets/panel.py
@@ -95,6 +95,11 @@ class PanelModal(QWidget):
         self.root_layout.addWidget(self.button_container)
         widget.parent_post_init()

+    def keyPressEvent(self, event: QtGui.QKeyEvent) -> None:  # noqa N802
+        if event.key() == QtCore.Qt.Key.Key_Escape:
+            self.close()
+        return super().keyPressEvent(event)
+
     def closeEvent(self, event):  # noqa: N802
         self.done_button.click()
         event.accept()

Thank you! However this patch overrides and breaks the following change in this PR:

  • In tag search panels, pressing the Esc key will return your focus to the search bar and highlight your previous query. If the search box is already highlighted, pressing Esc will close the modal

I did notice though that some panels were missed, such as the tag color selection panel, so I'll be making sure those work as intended in an upcoming PR or commit

@Tishj
Copy link

Tishj commented Feb 4, 2025

That is true, however currently Esc does nothing there, because the PanelModal takes precedence (because of the show() call) and no behavior for Esc is set in its key press event handler

@CyanVoxel
Copy link
Member Author

#793: I've added the event handler to every extra missing modal as well as tweaked the TagSearchPanel's handler to selectively defer to PanelWidget's handler rather than completely override it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Something isn't working as intended Type: Enhancement New feature or request Type: QoL A quality of life (QoL) enhancement or suggestion Type: Refactor Code that needs to be restructured or cleaned up Type: UI/UX User interface and/or user experience
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants