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

Fix selector attributes #1413

Merged
merged 2 commits into from
Aug 12, 2020
Merged

Fix selector attributes #1413

merged 2 commits into from
Aug 12, 2020

Conversation

timgl
Copy link
Collaborator

@timgl timgl commented Aug 12, 2020

Changes

Closes #1409. Filtering selectors with attributes wasn't working, because we are storing all attributes with the attr__ prefix. I had to use Django's "extra" function as using normal filtering didn't work.

Checklist

  • All querysets/queries filter by Team (if this PR affects any querysets/queries)
  • Backend tests (if this PR affects the backend)
  • Cypress E2E tests (if this PR affects the front and/or backend)

@timgl timgl requested a review from mariusandra August 12, 2020 11:27
@timgl timgl temporarily deployed to posthog-fix-selector-at-pvlo9i August 12, 2020 11:28 Inactive
Copy link
Collaborator

@mariusandra mariusandra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked and it works for me!

Though I'm somewhat confused here - I thought we actually shouldn't capture any data-* attributes? Isn't that how mixpanel got in trouble?

That being said, I might be in favour of adding a separate "data-attr" that we do always capture... and even use it in the selectors when it's available. I'm intrigued by the idea of being able to add "hints" that posthog picks up to provide better element identification, though I'm not yet 100% convinced that this is what we should do. Perhaps 100% autocapture with an AI-powered simmer is a better approach? 🤔

@timgl
Copy link
Collaborator Author

timgl commented Aug 12, 2020

Mixpanel primarily got in trouble by capturing attributes on input fields, which we don't do. I don't think data attributes are worrying.

@mariusandra
Copy link
Collaborator

Right. I think it was data attributes on input fields that got them in trouble. (Quote: "This change placed copies of the values of hidden and password fields into the input elements’ attributes, which Autotrack then inadvertently received.")

I guess it's fine to capture data attributes on buttons.

@timgl timgl merged commit 2585e95 into master Aug 12, 2020
@timgl timgl deleted the fix-selector-attributes branch August 12, 2020 16:55
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

Successfully merging this pull request may close these issues.

Filtering selector on attributes isn't working
2 participants