3 * A Backbone View that provides the aural view of a contextual link.
6 (function (Drupal, Backbone) {
7 Drupal.contextual.AuralView = Backbone.View.extend(/** @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')
39 .prop('hidden', !isOpen);
41 // Update the view of the trigger.
42 this.$el.find('.trigger')
43 .text(Drupal.t('@action @title configuration options', {
44 '@action': (!isOpen) ? this.options.strings.open : this.options.strings.close,
45 '@title': this.model.get('title'),
47 .attr('aria-pressed', isOpen);