Skip to content
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

Validation tooltip bug (from #30960) #31507

Closed
fchiumeo opened this issue Aug 19, 2020 · 2 comments
Closed

Validation tooltip bug (from #30960) #31507

fchiumeo opened this issue Aug 19, 2020 · 2 comments

Comments

@fchiumeo
Copy link

Fixing #25511 (#30960) introduced a new bug in tooltip validation

bootstrap doc

imagen

@domdomegg
Copy link

Why this is happening now

I've dug some digging, and this happens because left:0 sets the left edge of the validation feedback tooltip to the left edge of the parent element, ignoring padding.

The form row columns (.form-row>.col, .form-row>[class*=col-]) have a horizontal padding of 5px. This is ignored in setting the 'leftness' of the tooltip, so it appears 5px left of the inner box of the column.

This screenshot might help visualise what is happening (green is the col padding):

image

This doesn't happen with the username field in example #25511 because the padding is 0 within the .input-group container:

image

Why #25511 happened

Internet explorer is non standards compliant in respect to position: absolute, when left is not set (or is auto - what it should default to).

As per the CSS standard 10.3.7 (https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width), absolutely positioned elements should be placed where they would be if they were static elements for each axis.

When setting position: static to the validation tooltip in IE, we get:

image

Which clearly shows it should be left aligned with the field. However, IE seems to be ignoring this and placing it to the right of the element and we get this:

image

To fix this, #30960 set left: 0, which forced all browsers to align the tooltips to the leftmost of their parent containers. While this made them all do the same thing (as IE would follow that direction), it caused the issues mentioned above about alignment with padding.

A potential fix

I propose removing left:0 from the general CSS (as standards-compliant browsers display normally - I have tested in Chrome, Firefox and Edge). Then adding an IE-only hack to add:

  • left: $form-grid-gutter-width / 2 for validation tooltips inside form columns
  • left: 0 otherwise
    This should cover the majority of use cases for IE, and make browsers that aren't IE work properly.

@XhmikosR
Copy link
Member

Fixed in #31557

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

No branches or pull requests

3 participants