Focus interceptor

Focus interceptor can obscure sensitive data from recorded focus events.

Focus events can be completely omitted by returning false from the interceptor.

Example focus interceptor

{
  interceptors: {
    focus: (data, context) => {
      if (data.url.includes('/profile')) {
        // do not record any focus events from `/profile` page
        return false;
      }
      
      if (data.context?.target?.id === 'sensitive-element') {
        // Do not record focus on #sensitive-element
        return false;
      }
    }
}

Parameters

dataobject
data.urlstringURL of the page where the focus happened
contextFocusEventFocusEvent