Skip to content

Conversation

larseberhardt
Copy link
Contributor

@larseberhardt larseberhardt commented May 5, 2025

…om thead at the correct position in safari

Screenshot 2025-05-05 at 19 06 07

Resolves #4180

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This is my first PR! Sorry if there is something wrong. I've noticed today that the border in the table header move to the end of the table in Safari. Tried to fix it with still using the after pseudo element but I had no luck. Now we're not using the after element at all. The calculation in th is that the content doesn't get shifted by the border. You shouldn't notice any change in Chrome but this fixes the bug in Safari

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@benjamincanac
Copy link
Member

I see the issue on Safari, however your solution doesn't really fix the issue as it breaks the border on Chrome with sticky header. The sticky head was the reason I used ::after to set the border, it's a tricky one 😬

@larseberhardt
Copy link
Contributor Author

Uh I didn't checked with sticky header. I don't really get behind what Safari wants that it is displaying the pseudo element correct. I can see if I can find a other solution to fix it for Safari.

@benjamincanac benjamincanac marked this pull request as draft May 7, 2025 12:38
@benjamincanac benjamincanac added the v3 #1289 label May 7, 2025
@larseberhardt
Copy link
Contributor Author

I've figured out how it works with the pseudo after in safari and chrome. Instead of after:bottom-0 using after:end-full is doing it correctly.

@benjamincanac
Copy link
Member

It seems it does break the loading though 😬 Both bg now apply into thead::after and still need to see the gray border under the loading bar 🤔

Introduces a dedicated row for the table head underline to enable more flexible and maintainable header border styling. Refactors related theme classes to support this separation and resolves z-index layering for loading state visuals.
@larseberhardt
Copy link
Contributor Author

larseberhardt commented Jun 2, 2025

I’ve explored several CSS-based approaches to solve this issue, but unfortunately, Safari doesn’t respect the height of <thead> and instead uses the height of the entire <table>. This appears to be a known Safari bug.

One workaround I attempted was to read the height of <thead> and apply it manually to the top position of a pseudo-element. However, this solution is not ideal—pseudo-elements are not real DOM elements, and their styles are more difficult to manipulate dynamically.

As a more robust alternative, I added an actual <tr> element within the <thead> to serve as the visual line. This method works reliably with both position: sticky and non-sticky scenarios, and it integrates well with the loading state (which still uses a pseudo-element). Most importantly, this solution works consistently across all major browsers.

@larseberhardt larseberhardt marked this pull request as ready for review June 24, 2025 13:51
@benjamincanac
Copy link
Member

Nice found! I've renamed the theadLine to separator for consistency 😊

@benjamincanac benjamincanac changed the title fix(Table): update styles for thead and th elements to show border fr… fix(Table): use tr as separator Jun 24, 2025
Copy link

pkg-pr-new bot commented Jun 24, 2025

npm i https://pkg.pr.new/@nuxt/ui@4083

commit: 3d804cf

@benjamincanac benjamincanac merged commit edca3bc into nuxt:v3 Jun 24, 2025
6 checks passed
@larseberhardt larseberhardt deleted the tableSafariBorderFix branch June 24, 2025 15:19
@Barbapapazes
Copy link
Contributor

This breaks the z-index for modals and slideovers.

image

Copy link
Member

@Barbapapazes Would you mind opening a new issue for this? I can't seem to reproduce 🤔

@Barbapapazes
Copy link
Contributor

@Barbapapazes Would you mind opening a new issue for this? I can't seem to reproduce 🤔

yes, I will try a reproduction and open an issue if I can reproduce.

@Barbapapazes
Copy link
Contributor

Another project and also have the project

Screenshot 2025-07-13 at 11 15 05

@larseberhardt
Copy link
Contributor Author

Could offer a reproduction please and which browser are you using?

@Barbapapazes
Copy link
Contributor

Barbapapazes commented Jul 13, 2025

Ok, I found it. I was trying to do a reproduction using a Nuxt application and indeed, everything was working fine. My apps are build using Inertia so I looked for differences and I found that Nuxt uses an "isolate" class on the "app" and because the slideover is outside of this, everything is fine. I added this "isolate" class around my pages (not the body to avoid to encapsulate the modal / slideover) and it's working fine now.

Screenshot 2025-07-13 at 11 24 41

Copy link
Member

@Barbapapazes Sorry about that, I completely forgot to document that part as it is automatic for Nuxt, now fixed: 9cda333.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Border on table header not shown on safari, loading indicator not on the top
3 participants