rrweb-io / rrweb

record and replay the web
https://www.rrweb.io/
MIT License
15.9k stars 1.38k forks source link

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

Open ericmeadows opened 1 month ago

ericmeadows commented 1 month ago

Preflight Checklist

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...