Skip to content

Report elements with pointer style #228

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to the full browser extension will be documented in this fil

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

### Added
- Report elements that have cursor pointer style.

## 0.1.4 - 2025-06-30

### Fixed
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rec.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ All notable changes to the recorder browser extension will be documented in this

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## Unreleased

## 0.1.4 - 2025-06-30

### Added
Expand Down
21 changes: 21 additions & 0 deletions source/ContentScript/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,22 @@ function reportNodeElements(
}
}

function reportPointerElements(
source: Element | Document,
fn: (re: ReportedObject) => void
): void {
source.querySelectorAll('*').forEach((element) => {
const {tagName} = element;
const url = window.location.href;
if (tagName !== 'input' && tagName !== 'button' && tagName !== 'a') {
const compStyles = window.getComputedStyle(element, 'hover');
if (compStyles.getPropertyValue('cursor') === 'pointer') {
fn(new ReportedElement(element, url));
}
}
});
}

function reportPageLoaded(
doc: Document,
fn: (re: ReportedObject) => void
Expand All @@ -197,6 +213,7 @@ function reportPageLoaded(
reportPageForms(doc, fn);
reportElements(doc.getElementsByTagName('input'), fn);
reportElements(doc.getElementsByTagName('button'), fn);
reportPointerElements(doc, fn);
reportStorage(LOCAL_STORAGE, localStorage, fn);
reportStorage(SESSION_STORAGE, sessionStorage, fn);
}
Expand All @@ -209,10 +226,14 @@ const domMutated = function domMutation(
reportEvent(new ReportedEvent('domMutation'));
reportPageLinks(document, reportObject);
reportPageForms(document, reportObject);
reportPointerElements(document, reportObject);
for (const mutation of mutationList) {
if (mutation.type === 'childList') {
reportNodeElements(mutation.target, 'input', reportObject);
reportNodeElements(mutation.target, 'button', reportObject);
if (mutation.target.nodeType === Node.ELEMENT_NODE) {
reportPointerElements(mutation.target as Element, reportObject);
}
}
}
});
Expand Down
Loading