Fix toast positioning inside popups to align with the "Notifications" positioning option (#4506) * fix: adjust toast container positioning in popups to match core toastr behavior Fixes #4490 * Fix misplaced element role * Hide toast container while opening animation is running * fix: update toast role from alert to status --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>

f62eeb76a67517f49f0e545c16072b1a6b605233

Wolfsblvt <wolfsblvt@gmail.com>

Signed
2 files changed, +27 -10Ignore whitespace
public/css/popup.css+25 -8
@@ -26,7 +26,6 @@ dialog {
2626
2727 /* Fix weird animation issue with font-scaling during popup open */
2828 backface-visibility: hidden;
29- transform: translateZ(0);
3029 -webkit-font-smoothing: subpixel-antialiased;
3130
3231 /* Variables setup */
@@ -93,6 +92,11 @@ dialog {
9392 animation: fade-in var(--popup-animation-speed) ease-in-out;
9493}
9594
95+/* Fix toast container snapping into the backdrop while the animation is running */
96+.popup[opening] #toast-container {
97+ visibility: hidden;
98+}
99+
96100/* Open state of the dialog */
97101.popup[open] {
98102 color: var(--SmartThemeBodyColor);
@@ -118,17 +122,30 @@ body.no-blur .popup[open]::backdrop {
118122 animation: fade-out var(--popup-animation-speed) ease-in-out;
119123}
120124
121-.popup #toast-container {
125+/* Edge inset to match Toastr default spacing */
122- /* Fix toastr in dialogs by actually placing it at the top of the screen via transform */
126+:root {
123127 height--toast-edge: 100dvh12px;
124- top: calc(50% + var(--topBarBlockSize));
128+}
125- left: 50%;
126- transform: translate(-50%, -50%);
127129
128- /* Fix text align, popups are centered by default. toasts should not. */
130+.popup #toast-container {
131+ /* Popups are centered by default; toasts should not be */
129132 text-align: left;
130133}
131134
135+/* Per-position position adjustments caused by the top bar, inside the popup */
136+.popup #toast-container.toast-top-left {
137+ top: calc(var(--toast-edge) + var(--topBarBlockSize));
138+}
139+
140+.popup #toast-container.toast-top-center {
141+ /* toastr in core does not have a top offset on center, so we don't do that either in popups */
142+ top: var(--topBarBlockSize);
143+}
144+
145+.popup #toast-container.toast-top-right {
146+ top: calc(var(--toast-edge) + var(--topBarBlockSize));
147+}
148+
132149.popup-crop-wrap {
133150 margin: 10px auto;
134151 max-height: 75vh;
public/scripts/a11y.js+2 -2
@@ -64,8 +64,8 @@ const a11yRules = {
6464 [toolbarSelectors]: (element) => {
6565 element.setAttribute('role', 'toolbar');
6666 },
6767 '#toast-container .toast-message': (element) => {
6868 element.setAttribute('role', 'alertstatus');
6969 },
7070};
7171