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

[Tree Node Renderer]: Filter button visibility fix #831

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

MartynasStrazdas
Copy link
Contributor

Closes iTwin/viewer-components-react#1117

filter_button_visibility.mp4

Still need to check if visibility button also causes the same bug.

@MartynasStrazdas MartynasStrazdas requested a review from a team as a code owner January 8, 2025 15:37
Copy link

changeset-bot bot commented Jan 8, 2025

🦋 Changeset detected

Latest commit: ff1a102

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@itwin/presentation-hierarchies-react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@grigasp grigasp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a change file

@saskliutas
Copy link
Member

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

@MartynasStrazdas
Copy link
Contributor Author

MartynasStrazdas commented Jan 8, 2025

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

But at the same time previously clicking (with mouse) expand did not indicate that the expander is in focus so I don't think it is a big deal.

@saskliutas
Copy link
Member

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

@grigasp
Copy link
Member

grigasp commented Jan 9, 2025

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

I agree - clicking on the expander should probably focus the node the expander is on, or expander itself. That should also take care of the issue (visible in the demo) where filtering button doesn't go away when expanding child nodes.

@MartynasStrazdas
Copy link
Contributor Author

MartynasStrazdas commented Jan 9, 2025

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

I agree - clicking on the expander should probably focus the node the expander is on, or expander itself. That should also take care of the issue (visible in the demo) where filtering button doesn't go away when expanding child nodes.

Originally the click on expander would focus it, which would mean we'd still have the issue of filter button being visible after expander click.

@grigasp
Copy link
Member

grigasp commented Jan 9, 2025

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

I agree - clicking on the expander should probably focus the node the expander is on, or expander itself. That should also take care of the issue (visible in the demo) where filtering button doesn't go away when expanding child nodes.

Originally the click on expander would focus it, which would mean we'd still have the issue of filter button being visible after expander click.

Could we show the filtering button when the focus is within the node rather than directly on the node?

@MartynasStrazdas
Copy link
Contributor Author

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

I agree - clicking on the expander should probably focus the node the expander is on, or expander itself. That should also take care of the issue (visible in the demo) where filtering button doesn't go away when expanding child nodes.

Originally the click on expander would focus it, which would mean we'd still have the issue of filter button being visible after expander click.

Could we show the filtering button when the focus is within the node rather than directly on the node?

That how it originally works, thats why clicking on expander kept the filter even when hovering on other nodes.

@grigasp
Copy link
Member

grigasp commented Jan 9, 2025

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

I agree - clicking on the expander should probably focus the node the expander is on, or expander itself. That should also take care of the issue (visible in the demo) where filtering button doesn't go away when expanding child nodes.

Originally the click on expander would focus it, which would mean we'd still have the issue of filter button being visible after expander click.

Could we show the filtering button when the focus is within the node rather than directly on the node?

That how it originally works, thats why clicking on expander kept the filter even when hovering on other nodes.

LOL, yeah, you're right, we're back to the original issue.

I clicked around the "Source Control" tree in VSCode. The tree has similar stuff to ours: expanders, action buttons, keyboard navigation, etc. And I think it's pretty intuitive to use, so we should try to make ours similar. Here's what I think is needed:

  1. Make expander non-focusable at all. When user clicks on it, the whole node should get focused.
  2. When a node is focused, it should always have an outline. This is the key to this issue. It solves two problems that our tree currently has:
    • It's not clear why the filtering button is visible, because focused node has no outline.
    • It's not clear what'll happen when user starts keyboard navigation, because it's not clear what's focused.

Can we do that?

@saskliutas
Copy link
Member

Not sure if it's an issue but in previous version you could expand node and then continue navigating tree using keyboard arrows. With current implementation that is not a case.

If you mean by clicking the expand with mouse and then using keys, then it seems it would not be posible with this implementation, but using keys to expand the node and continuing to use them is still good.

Yes I am talking about expanding node using mouse and then continue with arrow keys.

I agree - clicking on the expander should probably focus the node the expander is on, or expander itself. That should also take care of the issue (visible in the demo) where filtering button doesn't go away when expanding child nodes.

Originally the click on expander would focus it, which would mean we'd still have the issue of filter button being visible after expander click.

Could we show the filtering button when the focus is within the node rather than directly on the node?

That how it originally works, thats why clicking on expander kept the filter even when hovering on other nodes.

LOL, yeah, you're right, we're back to the original issue.

I clicked around the "Source Control" tree in VSCode. The tree has similar stuff to ours: expanders, action buttons, keyboard navigation, etc. And I think it's pretty intuitive to use, so we should try to make ours similar. Here's what I think is needed:

  1. Make expander non-focusable at all. When user clicks on it, the whole node should get focused.

  2. When a node is focused, it should always have an outline. This is the key to this issue. It solves two problems that our tree currently has:

    • It's not clear why the filtering button is visible, because focused node has no outline.
    • It's not clear what'll happen when user starts keyboard navigation, because it's not clear what's focused.

Can we do that?

Maybe we should to get in touch with iTwinUI team regarding missing outline when node becomes focused after expander is clicked?

@grigasp
Copy link
Member

grigasp commented Jan 9, 2025

Maybe we should to get in touch with iTwinUI team regarding missing outline when node becomes focused after expander is clicked?

I think you're better suited to decide whether it's a bug in iTwinUI or something that should be implemented on our end. Contacting them and asking what they think seems reasonable.

@MartynasStrazdas MartynasStrazdas enabled auto-merge (squash) January 13, 2025 09:12
@MartynasStrazdas
Copy link
Contributor Author

Maybe we should to get in touch with iTwinUI team regarding missing outline when node becomes focused after expander is clicked?

I think you're better suited to decide whether it's a bug in iTwinUI or something that should be implemented on our end. Contacting them and asking what they think seems reasonable.

Tried the solution provided by ItwinUI with some tweaks, this solution would still be affected by the double border (like we see with multi select). This would be a css only solution.

navigation.mp4

@grigasp @saskliutas

@grigasp
Copy link
Member

grigasp commented Jan 14, 2025

Maybe we should to get in touch with iTwinUI team regarding missing outline when node becomes focused after expander is clicked?

I think you're better suited to decide whether it's a bug in iTwinUI or something that should be implemented on our end. Contacting them and asking what they think seems reasonable.

Tried the solution provided by ItwinUI with some tweaks, this solution would still be affected by the double border (like we see with multi select). This would be a css only solution.

@grigasp @saskliutas

LGTM

@saskliutas
Copy link
Member

Maybe we should to get in touch with iTwinUI team regarding missing outline when node becomes focused after expander is clicked?

I think you're better suited to decide whether it's a bug in iTwinUI or something that should be implemented on our end. Contacting them and asking what they think seems reasonable.

Tried the solution provided by ItwinUI with some tweaks, this solution would still be affected by the double border (like we see with multi select). This would be a css only solution.

navigation.mp4
@grigasp @saskliutas

Much better.

Copy link
Member

@grigasp grigasp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need a change file

@MartynasStrazdas MartynasStrazdas merged commit 29d17f0 into master Jan 14, 2025
8 checks passed
@MartynasStrazdas MartynasStrazdas deleted the mast/node-filter-button-visibility-fix branch January 14, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tree widget: Hierarchy level filtering action button is always displayed on last expanded node
3 participants