Home | History | Annotate | Download | only in demo
      1 <!--
      2 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
      3 This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
      4 The complete set of authors may be found at http://polymer.github.io/AUTHORS
      5 The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
      6 Code distributed by Google as part of the polymer project is also
      7 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
      8 -->
      9 
     10 <link rel="import" href="../../polymer/polymer.html">
     11 <link rel="import" href="../../paper-button/paper-button.html">
     12 <link rel="import" href="../iron-a11y-announcer.html">
     13 
     14 <dom-module id="x-announces">
     15   <style>
     16     :host {
     17       display: block;
     18       position: relative;
     19       padding: 1em 0;
     20     }
     21 
     22     paper-button {
     23       background: #4285f4;
     24       color: #fff;
     25     }
     26   </style>
     27   <template>
     28     <paper-button on-tap="_onTapAnnounce" raised>Announce</paper-button>
     29     <span id="content" aria-hidden="true">
     30       <content></content>
     31     </span>
     32   </template>
     33   <script>
     34     Polymer({
     35       is: 'x-announces',
     36 
     37       attached: function() {
     38         Polymer.IronA11yAnnouncer.requestAvailability();
     39       },
     40 
     41       _onTapAnnounce: function() {
     42         this.fire('iron-announce', {
     43           text: this.$.content.textContent.trim()
     44         }, {
     45           bubbles: true
     46         });
     47       }
     48     });
     49   </script>
     50 </dom-module>
     51