Skip to content

Commit

Permalink
Merge pull request #620 from chenasraf/fix/non-string-input-value-click
Browse files Browse the repository at this point in the history
fix: non-string form input values on click interaction
  • Loading branch information
ender336 authored Jul 1, 2024
2 parents 72cff8e + 84c65e3 commit 0b13a5e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/clarity-js/src/interaction/click.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function text(element: Node): string {
let output = null;
if (element) {
// Grab text using "textContent" for most HTMLElements, however, use "value" for HTMLInputElements and "alt" for HTMLImageElement.
let t = element.textContent || (element as HTMLInputElement).value || (element as HTMLImageElement).alt;
let t = element.textContent || String((element as HTMLInputElement).value || '') || (element as HTMLImageElement).alt;
if (t) {
// Replace multiple occurrence of space characters with a single white space
// Also, trim any spaces at the beginning or at the end of string
Expand Down

0 comments on commit 0b13a5e

Please sign in to comment.