Skip to content

experiment: add dialog base styles and visual tests #9438

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

Open
wants to merge 22 commits into
base: main
Choose a base branch
from

Conversation

jouni
Copy link
Member

@jouni jouni commented Jun 9, 2025

Screenshot 2025-06-17 at 10 09 37

Supported custom properties

Property Description
--vaadin-dialog-background
--vaadin-dialog-border-width
--vaadin-dialog-border-color
--vaadin-dialog-border-radius
--vaadin-dialog-box-shadow
--vaadin-dialog-min-width 4em. Never larger than 100% (viewport width).
--vaadin-dialog-max-width none
--vaadin-dialog-title-color
--vaadin-dialog-title-font-size 1em
--vaadin-dialog-title-font-weight 600
--vaadin-dialog-title-line-height inherit
--vaadin-dialog-padding The padding inside the header, content, and footer parts.
--vaadin-dialog-toolbar-gap The gap between items in the header and footer toolbars.

@jouni jouni force-pushed the experiment/base-dialog branch from e1baa6f to 1ab2729 Compare June 9, 2025 10:56
@web-padawan web-padawan force-pushed the experiment/base-dialog branch from 1ab2729 to 654b885 Compare June 10, 2025 14:49
Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

Rebased and force-pushed to work after some core styles refactoring on main branch.

@web-padawan web-padawan force-pushed the experiment/base-dialog branch 2 times, most recently from 6e7938b to 42784d0 Compare June 10, 2025 14:58
@web-padawan
Copy link
Member

For some reason in the dev page the overlay collapses when toggling setting width: 280px (works fine with 300px):

Screenshot 2025-06-10 at 16 57 05

@jouni
Copy link
Member Author

jouni commented Jun 16, 2025

For some reason in the dev page the overlay collapses when toggling setting width: 280px (works fine with 300px):

Thanks. Actually, that checkbox sets the height, I just forgot to update the label when I copied it. And setting the height of the dialog triggers the size container and size containment, which ends up collapsing the width.

I can fix this if I remove this if statement here, and always set the original bounds when resize is initiated:

if (this.$.overlay.$.overlay.style.position !== 'absolute' || this.width || this.height) {
this.$.overlay.setBounds(this._originalBounds);
}

I’m not sure what this optimization accomplishes.

@jouni
Copy link
Member Author

jouni commented Jun 16, 2025

setting the height of the dialog triggers the size container and size containment, which ends up collapsing the width.

For the record, I ended up removing this feature (2a9aedd), as it’s likely unexpected for users/designers/developers. It’s probably better to leave this type of behavior for app-specific styles. Alternatively, we should flesh out the feature properly, how it could behave more robustly.

@web-padawan
Copy link
Member

I’m not sure what this optimization accomplishes.

Added back in vaadin/vaadin-dialog@37a460c - apparently it was supposed to be only called on first drag / first resize.

@jouni
Copy link
Member Author

jouni commented Jun 16, 2025

apparently it was supposed to be only called on first drag / first resize

Right. Would be great to find out what the original issue was. I didn't notice any immediate downsides, but who knows, might be some weird edge case.

@web-padawan web-padawan force-pushed the experiment/base-dialog branch from 4ad6f0b to 36b30d5 Compare June 16, 2025 17:55
@jouni
Copy link
Member Author

jouni commented Jun 16, 2025

But regardless of the original issue, the size of the dialog should become fixed when the users drags it. Also, the size can become fixed in both directions when the user resizes either the width or the height.

@web-padawan
Copy link
Member

Would be great to find out what the original issue was. I didn't notice any immediate downsides

Checked the review comments and couldn't find any issue that was referring to this change specifically 🤷‍♂️
IMO we can remove these checks indeed, at least based on the code it's unlikely to cause any problems.

@jouni
Copy link
Member Author

jouni commented Jun 16, 2025

@web-padawan, any idea why the visual tests fail?

@web-padawan
Copy link
Member

Looks like I handled rebase incorrectly, pushed a fix to import overlay base styles from the correct location.

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

Let's consider reviewing #9486 and then rebasing this PR once that one is merged.

@web-padawan web-padawan changed the title experiment: Dialog base styles experiment: add dialog base styles and visual tests Jun 18, 2025
Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

One more thing which is demo-page specific: on main branch, when you open a dialog, then drag it, close and reopen, it will use the previous position. In the new dev page, every button click opens another dialog, which isn't immediately obvious. Not sure if we should spend time changing this.

Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

LGTM overall, but maybe someone else from the team should also review before merging.

Copy link

@web-padawan web-padawan requested a review from vursen June 18, 2025 14:26
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.

3 participants