-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Always collapse an expanded kind without changing selected story #1590
Conversation
Not sure what the "best" behavior is, but I agree this looks like an improvement. 👍 |
Definitely an improvement. I still would prefer that any time you click a kind, it doesn't change the active story, whether expanding or collapsing. That feels like more consistent behavior to me. But I don't know, what does everyone else think? |
I think it depends on what do you do more often: explore the tree, or actually navigate through stories |
True. I think my reasoning is that it looks almost identical to file trees in applications like VS Code or Atom, so my first intuition is that it will navigate the same way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -261,6 +261,31 @@ describe('manager.ui.components.left_panel.stories', () => { | |||
expect(onSelectStory).toHaveBeenCalledWith('a', null); | |||
}); | |||
|
|||
test('should call the onSelectStory prop when an expanded kind is clicked', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should NOT call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure
@@ -261,6 +261,31 @@ describe('manager.ui.components.left_panel.stories', () => { | |||
expect(onSelectStory).toHaveBeenCalledWith('a', null); | |||
}); | |||
|
|||
test('should call the onSelectStory prop when an expanded kind is clicked', () => { | |||
const data = createHierarchy([ | |||
{ kind: 'a', stories: ['a1', 'a2'] }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeFactor warns about these lines are duplicated. Maybe change something here..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will try
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so i extracted common vars in the whole test for consistency
Codecov Report
@@ Coverage Diff @@
## master #1590 +/- ##
=======================================
Coverage 20.41% 20.41%
=======================================
Files 241 241
Lines 5255 5255
Branches 645 655 +10
=======================================
Hits 1073 1073
+ Misses 3695 3676 -19
- Partials 487 506 +19
Continue to review full report at Codecov.
|
@Hypnosphi I couldn't find such behavior in the latest releases, was it removed completely or is there any possibility to turn this on? Also I couldn't find option to make tree view be expanded or collapsed by a single click, I think it would be useful for saving clicks as well. |
@igor-dv decided to remove it |
Currently, the stories hierarchy has a confusing behaviour when you click on an expanded kind. If the kind was selected at the moment of clicking, it collapses, but the selected story changes to the first of kind. Otherwise, the first story is selected without collapsing the kind.
I've changed this behaviour to always collapsing without selected story. I preferred though to keep the behaviour when a collapsed kind is expanded along with selecting the first story: this looks quite useful and usually saves a click.
before (note the change in iframe on first click)
after