3 * A Backbone View that provides the aural view of a contextual link.
6 (function(Drupal, Backbone) {
7 Drupal.contextual.AuralView = Backbone.View.extend(
8 /** @lends Drupal.contextual.AuralView# */ {
10 * Renders the aural view of a contextual link (i.e. screen reader support).
14 * @augments Backbone.View
16 * @param {object} options
17 * Options for the view.
20 this.options = options;
22 this.listenTo(this.model, 'change', this.render);
24 // Use aria-role form so that the number of items in the list is spoken.
25 this.$el.attr('role', 'form');
35 const isOpen = this.model.get('isOpen');
37 // Set the hidden property of the links.
38 this.$el.find('.contextual-links').prop('hidden', !isOpen);
40 // Update the view of the trigger.
44 Drupal.t('@action @title configuration options', {
46 ? this.options.strings.open
47 : this.options.strings.close,
48 '@title': this.model.get('title'),
51 .attr('aria-pressed', isOpen);