In my previous post, I tested my skeleton directive on Vuetify and Nuxt UI. I ended the post asking people to try it on other component libraries.

I also tested it on PrimeVue, Quasar and Element Plus myself. Two more things broke.

If you haven't seen the directive before, the idea is pretty simple:

<UserCard v-skeleton="loading" :user="user" /> 

It uses CSS to turn the existing component into its own skeleton instead of maintaining separate loading markup.

The text in my tables disappeared

Element Plus wraps the contents of a table cell in a div. PrimeVue does something similar with its column headers.

Here's a simplified version of the rendered HTML:

<!-- Element Plus --> <td> <div class="cell">Apples</div> </td> <!-- PrimeVue --> <th> <div> <span>Name</span> </div> </th> 

When skeleton mode was active, the text disappeared, but there was no skeleton bar in its place.

The problem was in my CSS selectors.

I was excluding elements inside tags like td, th and p to avoid drawing the same text bar twice. The assumption was that the parent would already draw it.

But a td containing a div didn't qualify as a text block. The inner div was also excluded because it was inside a td.

Neither element ended up drawing a bar.

Missing table skeleton text bars in v0.5.1 and restored bars in v0.5.2

The fix was to check whether the ancestor actually qualifies as a text block before excluding its descendants.

Now the inner div in the Element Plus cell gets its own bar, and the PrimeVue header gets a single bar on its wrapper without drawing another one on the span.

A blue button in the middle of a skeleton

The other issue came from Quasar.

<q-btn color="primary" label="Save" /> 

The skeleton hid the label, but the original background color could survive.

Quasar's bg-* classes use !important, while my skeleton background was a normal CSS declaration.

The obvious fix was to make my background important too. The problem is that the pulse animation was changing background-color directly, and CSS animations can't override important declarations.

I'd already used a registered CSS custom property for the text bar animation in 0.5.0, so I reused that approach for the blocks.

Here's a simplified version of the fix:

@property --vslk-skz-color { syntax: "<color>"; inherits: false; initial-value: transparent; } .skeleton-block { --vslk-skz-color: var(--vslk-sk-base); background-color: var(--vslk-skz-color) !important; animation: vslk-skz-pulse 1.5s ease-in-out infinite; } @keyframes vslk-skz-pulse { 0%, 100% { --vslk-skz-color: var(--vslk-sk-base); } 50% { --vslk-skz-color: var(--vslk-sk-hi); } } 

The important background declaration stays in place. The animation changes the value of the custom property instead.

Blue button background visible in v0.5.1 and correctly covered by the skeleton in v0.5.2

This also addresses the same kind of conflict with important background utilities in Tailwind.

Adding regression tests

I didn't need to install three more UI libraries as test dependencies. I could reproduce both problems using the relevant HTML and CSS in my existing browser test fixture.

For the table, I added checks for where the underline should and shouldn't appear:

expect(css(".td-inner").textDecorationLine) .toBe("underline"); expect(css(".th-inner").textDecorationLine) .toBe("underline"); expect(css(".th-title").textDecorationLine) .toBe("none"); expect(css(".td-cell").textDecorationLine) .toBe("none"); 

For the second bug, I added a button with an important blue background:

.imp-bg { background-color: #2563eb !important; } 

And checked its computed background color after skeletonizing it:

expect(css(".imp-bg").backgroundColor) .not.toBe("rgb(37, 99, 235)"); 

Both regression tests and their fixes went into version 0.5.2 on November 16.

One limitation that remains

Some components, such as PrimeVue's Menu, have multiple root nodes.

Vue ignores custom directives applied directly to multi-root components and logs a warning.

For those components, the workaround is to put the directive on a wrapping element:

<div v-skeleton="loading"> <Menu :model="items" /> </div> 

I've documented this in the README.

After testing on five UI libraries, I think I'll spend more time looking at their rendered HTML when adding browser tests. A component can look simple from its Vue template and still produce markup I hadn't accounted for.

If you're using a UI library I haven't tested yet, I'd be interested to see what happens when you try the directive on it.

GitHub · Live demo · StackBlitz