Text & buttons are not vertically centered on toast component

Aperta Adatta ai principianti
#43,484 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
css, javascript, scss
Ambito
frontend

Direzione di ricerca

Inizia leggendo gli stili del componente toast di Bootstrap e le variabili toast per la dimensione del carattere e il padding verticale; l’issue non indica file o test specifici. Verifica in che modo l’interlinea ereditata influisce sull’altezza dell’intestazione e sull’allineamento verticale con una scala di 1:1. Il lavoro è completato quando il testo del toast e i pulsanti sono centrati verticalmente e il pixel aggiuntivo segnalato è scomparso.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug confirmed css has-pr v6
Prerequisites
Describe the issue

The text & buttons on the toast component are not vertically centered. This is very noticeable on 1:1 scaling. This issue might not be so visible on high-DPI screens (2:1 or 3:1), due to how scaling works.

issue-4-1

A zoomed-in view better shows the issue with the text:

issue-4-2

A zoomed-in view better shows the issue with the buttons:

issue-4-3

This issue is caused by the line-height being ommited, and therefore inherited to 1.5. Because --toast-font-size is set to .875rem, the computed line height is 21px, and since the toast-padding-y is set to .75rem (which is 12px), the total computed height of the toast header is 45px instead of 44px, therefore an additional pixel is present at the bottom row (because the line height was computed to 21px and the font-size is 14px, there's 3px at the top and 4px at the bottom of the line. This also causes the button, which is a square (20px by 20px) not being centered, as there's no way to position 20px vertically on 21px of available space.

Reduced test cases

Go to: https://getbootstrap.com/docs/6.0/components/toasts/#basic on a screen that does not do any scaling (1:1 mapping), and observe the toast text text not being vertically centered.

What operating system(s) are you seeing the problem on?

Linux, iOS, Android, macOS, Windows

What browser(s) are you seeing the problem on?

Opera, Firefox, Microsoft Edge, Safari, Chrome

What version of Bootstrap are you using?

v6

Lingua principale
JavaScript
Stelle
175k
Fork
78.9k
Merge medio
4g 2h
PR unite (30g)
89

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di twbs/bootstrap

Tutte le issue di twbs/bootstrap

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.