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