Functions.js inside WP

I try to avoid an error inside WP:

  • functions.js?ver= Uncaught ReferenceError: screenReaderText is not defined
    It is inside theme and js folder.

As is an error inside Chrome validation and related to theme, how to fix such errors?
/* global screenReaderText /
/
*

  • Theme functions file.
  • Contains handlers for navigation and widget area.
    */

text: screenReaderText.expand for line 19
initMainNavigation( $( ‘.main-navigation’ ) ); for line 45
} )( jQuery ); for line 200.

It is not related to our theme.

You could mock up a screenReaderText object:

var screenReaderText = {
    expand: function () {
        // do nothing
    }
};

But I’d recommend instead getting the proper screenReaderText object that it wants to use, even though you have no plans to use it.