-
Notifications
You must be signed in to change notification settings - Fork 405
Support for manual viewport size input & reintroduce resize key combinations #1146
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
Support for manual viewport size input & reintroduce resize key combinations #1146
Conversation
- Fixed test cases incorrect - Fixed view all pages not generated - Fixed view all page could not be loaded - Fixed pattern ordering - Fixed subfolder patterns have invalid data - Fixed subfolder patterns are not rendered properly
|
Hey thanks so much for your help getting this original PL feature re-enabled @JosefBredereck! Starting to take a look at this... 👀 |
...ges/uikit-workshop/src/scripts/lit-components/pl-viewport-size-list/pl-viewport-size-list.js
Outdated
Show resolved
Hide resolved
sghoweri
left a comment
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.
Besides the changes in the pl-viewport-size-list.js file (which I'm on the fence on), there's a couple of things I'd recommend we iterate on to get this 100% up to speed (which FWIW is why this original PL feature wasn't yet re-enabled with the major UI refactor -- hadn't gotten around to buttoning up all of these interactions).
Let know if any of these (below) don't make sense or if there's anything here you feel strongly against (or think we should punt on) -- again, I really appreciate the help maintaining Pattern Lab's UI -- can't wait to get this quality of life feature re-enabled!!
Recommendations:
- Clicking on the
pxtext should focus on the input (maybe wrap the whole thing in a<label>tag? - We should try to update the base font size of the input field (at least on smaller screen sizes) to avoid having iOS (and Android?) zoom in while the input is focused... maybe change the input type while we're at it?
- Unlike the original implementation of this functionality, you can no longer press the up or down arrow keys. Ideally the behavior I think we’d want to see here would be:
- Pressing up or down on the arrow keys will increment / decrement the size by 1
- Pressing shift + the up or down on the arrow keys would increment / decrement the viewport size by 10
- Entering in a valid number into the input should automatically trigger the viewport to resize (or at the very least, entering a number into the input and tabbing away) — ie. I feel like users should be able to change the viewport size by simply changing the number (vs requiring them to hit enter)... 🤔
- Deleting the text from the current viewport size and tabbing away should reset the displayed value to reflect the current viewport resized width
- If the user inputs a value that’s outside of the min / max range of viewport sizes (and hits enter since that’s the current behavior on this PR branch I’m reviewing) — the displayed viewport size should correct itself to that min / max size vs displaying a value that’s out of bounds… Or to put it another way, the viewport resizer width should always be 100% in sync with the displayed size!
Side note: FWIW, I’ve never been a fan of the em option that displays next to the viewport size in pixels. That said, are users going to be confused by being able to (once again) set one input but not the other?
|
That's some valid points.
Yes and No. I also tested that behavior. But let's imagine you are at
Should be fixed before merge.
Therefore we need Blur the input field when pressing enter so that the input value will start the sync again.
Actually that's something I was always wondering about. Or at least why that em is even there. |
| <input | ||
| class="pl-c-viewport-size__input pl-c-viewport-size__input-action" | ||
| .value="${this.state.inputPixelValue}" | ||
| @keypress=${this.handlePixelUpdate} |
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.
Also, I need to mention that I'm not that well known with React. Maybe there is a better approach for handling an input and replace/prevent an invalid key. In Angular, there are directives for that.
|
@sghoweri I added some more functionality. Please have a look at these too. 👍 |
packages/uikit-workshop/src/scripts/lit-components/pl-viewport-size/pl-viewport-size.js
Show resolved
Hide resolved
One of the primary use cases of the viewport resizer is to exactly test media queries. I can almost certainly guarantee Chris makes it sound as if this is no longer needed, which TIL. |
|
Oh no, I merged the wrong dev branch here 😢 |
|
It can not be saved, I close this one and make a new 🤦 |

Closes
Summary of changes:
Features