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