-
Notifications
You must be signed in to change notification settings - Fork 179
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
Story Editor: Preset Panel Height & Collapse Persistence #4601
Conversation
Size Change: +3.73 kB (0%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
@swissspidy Should we allow a partial panel open like this or size it to the closest color swatch? Doesn't have to be part of this PR, but from a UX standpoint this feels odd. At least for the first row. |
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.
This works well. Tested both the sizing of the saved presets and then the collapse states of the other design panels too.
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.
Looks good, just a few minor comments.
@@ -35,6 +35,9 @@ describe('Panel: Style Presets', () => { | |||
}; | |||
|
|||
beforeEach(async () => { | |||
// Make sure panels are starting at initial state on every test | |||
localStorage.clear(); |
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.
Hm, this should probably go in some global reset. @swissspidy, suggestions?
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.
Yea let me know here. I'm not the most familiar with the Karma tests, but think this was causing the main issue
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.
Yeah probably. karma/fixture/init.js
has similar resets already.
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.
Can be done in a follow-up ticket / PR too, FWIW
@carlos-kelly Good catch! Sounds like an odd thing to allow. There's probably some UX definition for this already. I suggest opening an issue and tagging Sam there. |
Codecov Report
@@ Coverage Diff @@
## main #4601 +/- ##
===========================================
+ Coverage 70.10% 83.33% +13.22%
===========================================
Files 881 881
Lines 15519 15444 -75
===========================================
+ Hits 10880 12870 +1990
+ Misses 4639 2574 -2065
Flags with carried forward coverage won't be shown. Click here to find out more.
|
… in fixture. leaving in beforeEach for now
OMG amazing. Thank you! |
); | ||
parsed = JSON.parse(stored); | ||
} catch (e) { | ||
// @TODO Add some error handling. |
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.
Hmm setInitialBannerPreviouslyClosed
in useTelemetryOptIn
should probably also wrap this in a try/catch
cc @dmmulroy
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.
I have no problem updating it, but what error is this catching? It seems like exceptions can be potentially thrown if the user has prevented a site from using Storage APIs, but none of our other localstorage
uses are wrapped in try/catch (see just below). Should we mandate that all localstorage
access be wrapped, or a utility to check for access prior to using it?
Also, what is the second argument to getItem
? AFAIK it only accepts one and it will already return null
by default if a key does not exists which is fine to pass to JSON.parse
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.
This works for me!
Just saw Pascal's comment about default size of the lay panel, once that's good I'm good with this 👍 |
Summary
Persists height and collapsed state of all panels in story editor. Panels should remain collapse & height between reloads, element selection & switching stories now.
Relevant Technical Choices
Persisted all panels height & collapsed state.
To-do
NA
User-facing changes
collapse/height state changes to all panels should now maintain between any actions in the editor.
Testing Instructions
Go to edit a story.
Partially fixes #825