Open corywatilo opened 1 year ago
Related...
When trying to define an action using the toolbar, it can correctly read the classes and loads them into the selector field...
... but trying to save an event with non-supported selectors breaks the page.
Two more things that can't be done today:
These work (individually):
.text-sm
.text-center
This doesn't:
.text-sm.text-center
This doesn't work:
.text-sm .text-center
Bug description
PostHog doesn't support HTML selector matches with CSS classes that contain non-alphanumeric characters. This becomes a problem for sites that use Tailwind CSS. If a customer is strictly using Tailwind, targeting HTML selectors becomes tricky.
Examples:
Example HTML for an element like this (defined in this action):
Here's what PostHog sees:
It's worth noting that, while the class in the DOM shows like
text-[15px]
, the Tailwind class it's actually referencing (as seen in the Styles tab in Inspector) escapes characters like[
,]
,.
:I also tried creating an action that escaped the non-alphanumeric characters (like
.border-\[1\.5px\]
) but it returns a500
error when trying to calculate:Somewhat related: https://github.com/PostHog/posthog/issues/3047