-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add additional css margin controls to Feedback Modal #14539
Comments
Hy, your workaround seems fine as you can define all margins with the shorthand Or maybe I understand something wrong? |
I think the main issue here, from my perspective, is that it is not in line with the modal's documentation. The docs indicate that the value is a single number, but I needed to supply 4 numbers. While this works, my concern with using undocumented workarounds is that they are inherently fragile and could be inadvertently broken by a future update since this workaround is not written down anywhere (beyond this issue). It isn't broken, but it could be accidentally. (Also, my apologies for the delayed response.) |
Hey @craigbehnke thanks, I just added a note on our docs for shorthand margin values. |
Problem Statement
Add additional CSS variables to specify specific margin amounts for top/bottom/left/right on the feedback modal.
In order to fit the modal into a screen on platforms like Ionic Capacitor on mobile, it would be incredibly valuable to have additional css variables to add a margin around the div.dialog__position beyond the inset.
This is the current behavior without any CSS variables applied, purely out of the box:
This is what I want to be able to do using the individual margin variables:
This is what I can do with the current tooling, setting only --page-margin:
Solution Brainstorm
Add additional CSS variables for configuration:
--page-margin-top
--page-margin-bottom
--page-margin-left
--page-margin-right
These variable names are consistent with the existing
--page-margin
variable.These variables could then be included in the
.dialog__position
class to specify the configured margin, while also defaulting to existing behavior:In a case where the developer does not set the specific variables, each statement would evaluate to --page-margin - --page-margin, which would always be 0px.
In a case where the developer has configured the specific margin variable, however, it would add the difference between the desired margin and the default page margin, effectively overriding it.
As a note, it appears that this functionally only applies in cases where the window is 600px wide or less (i.e. mobile) where the mode switches from
padding
toinset
.Edit: Current Workaround
After looking at the code a bit more, I did find a workaround that works but is incredibly hack-y: I can set the
--page-margin
variable with the arguments for theinset
property, like this:The reason why this is incredibly hack-y is that the docs specify the default value as 16px, which means that this is not CSS typesafe.
The text was updated successfully, but these errors were encountered: