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

[Bug]: maskInputFn is not called on inputs #1488

Open
1 task done
ericmeadows opened this issue May 29, 2024 · 2 comments
Open
1 task done

[Bug]: maskInputFn is not called on inputs #1488

ericmeadows opened this issue May 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@ericmeadows
Copy link

Preflight Checklist

  • I have searched the issue tracker for a bug report that matches the one I want to file, without success.

What package is this bug report for?

rrweb-snapshot

Version

v1.1.3

Expected Behavior

I have created a maskInputFn, which should print the element, as well as ignore hidden elements...

Actual Behavior

No console logs appear, and the hidden fields come through, unmasked..

Steps to Reproduce

I have created a maskInputFn, which I would assume would sanitize my inputs, but the data is coming through...

Here's maskInputFn:

  function maskInputFn(text, element) {
    console.log("element", element);
    if (element.type === "hidden") {
      return "";
    }
    // Default to returning the original text
    return text;
  }

Here's the initialization:

rrwebRecord({
  emit(event) {
    console.log("emitting");
    cacheEvents(event);
  },
  maskInputOptions: { maskInputFn },
  maskInputFn
});

Testcase Gist URL

No response

Additional Information

This is extremely important for us to handle...

@ericmeadows ericmeadows added the bug Something isn't working label May 29, 2024
@chetan-187
Copy link

Let me have a look at it

@chetan-187
Copy link

chetan-187 commented Sep 3, 2024

@ericmeadows You are passing wrong value in maskInputOptions, it accepts an object with following keys with boolean values.

{
color: boolean;
date: boolean;
'datetime-local': boolean;
email: boolean;
month: boolean;
number: boolean;
range: boolean;
search: boolean;
tel: boolean;
text: boolean;
time: boolean;
url: boolean;
week: boolean;
textarea: boolean;
select: boolean;
password: boolean;
}

You are passing your function in maskInputOptions.

If you want your function to work, you need to pass which of above keys you want to ignore. I think that's not the correct implementation.

Correct implementation should be, if you are passing maskInputFn every input should go through that function regardless of the maskInputOptions.

Any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants