|
15 | 15 | popovertargetaction="toggle" |
16 | 16 | id="menu-1"> |
17 | 17 | Menu A |
| 18 | + <div id="tooltip-1" class="tooltip" popover="hint">Tooltip A</div> |
18 | 19 | </button> |
19 | 20 |
|
20 | 21 | <button |
21 | 22 | popovertarget="submenu-2" |
22 | 23 | popovertargetaction="toggle" |
23 | 24 | id="menu-2"> |
24 | 25 | Menu B |
| 26 | + <div id="tooltip-2" class="tooltip" popover="hint">Tooltip B</div> |
25 | 27 | </button> |
26 | 28 |
|
27 | 29 | <button |
28 | 30 | popovertarget="submenu-3" |
29 | 31 | popovertargetaction="toggle" |
30 | 32 | id="menu-3"> |
31 | 33 | Menu C |
| 34 | + <div id="tooltip-3" class="tooltip" popover="hint">Tooltip C</div> |
32 | 35 | </button> |
| 36 | + |
| 37 | + <div id="submenu-1" popover="auto"> |
| 38 | + <button>Option A</button><br /><button>Option B</button> |
| 39 | + </div> |
| 40 | + <div id="submenu-2" popover="auto"> |
| 41 | + <button>Option A</button><br /><button>Option B</button> |
| 42 | + </div> |
| 43 | + <div id="submenu-3" popover="auto"> |
| 44 | + <button>Option A</button><br /><button>Option B</button> |
| 45 | + </div> |
33 | 46 | </section> |
34 | 47 | </div> |
35 | 48 |
|
36 | | - <p class="help-para"> |
37 | | - Press the buttons to show the auto popovers. Hover or focus the buttons to |
38 | | - show the hint popovers. When an auto popover is shown, you can show the |
39 | | - hint popovers without hiding it. See |
40 | | - <a |
41 | | - href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using#using_hint_popover_state" |
42 | | - >Using "hint" popover state</a |
43 | | - > |
44 | | - for more information. Note that in non-supporting browsers, the position |
45 | | - of the popovers is broken. |
46 | | - </p> |
47 | | - |
48 | | - <div id="submenu-1" popover="auto"> |
49 | | - <button>Option A</button><br /><button>Option B</button> |
50 | | - </div> |
51 | | - <div id="submenu-2" popover="auto"> |
52 | | - <button>Option A</button><br /><button>Option B</button> |
| 49 | + <div class="help-para"> |
| 50 | + <p> |
| 51 | + Press the buttons to show the auto popovers. Hover or focus the buttons |
| 52 | + to show the hint popovers. When an auto popover is shown, you can show |
| 53 | + the hint popovers without hiding it. See |
| 54 | + <a |
| 55 | + href="https://developer.mozilla.org/en-US/docs/Web/API/Popover_API/Using#using_hint_popover_state" |
| 56 | + >Using "hint" popover state</a |
| 57 | + > |
| 58 | + for more information. |
| 59 | + </p> |
| 60 | + <p> |
| 61 | + Note that this demo uses both hint popovers and CSS anchor positioning. |
| 62 | + Browsers that don't support the former will experience different tooltip |
| 63 | + behavior. Browsers that don't support the latter will not see the menus |
| 64 | + and tooltips appear in the correct position relative to each button on |
| 65 | + the button bar. Check browser support for |
| 66 | + <a |
| 67 | + href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/popover#browser_compatibility" |
| 68 | + >hint popovers</a |
| 69 | + > |
| 70 | + and |
| 71 | + <a |
| 72 | + href="https://developer.mozilla.org/en-US/docs/Web/CSS/position-anchor#browser_compatibility" |
| 73 | + >anchor-positioning</a |
| 74 | + >. |
| 75 | + </p> |
53 | 76 | </div> |
54 | | - <div id="submenu-3" popover="auto"> |
55 | | - <button>Option A</button><br /><button>Option B</button> |
56 | | - </div> |
57 | | - |
58 | | - <div id="tooltip-1" class="tooltip" popover="hint">Tooltip A</div> |
59 | | - <div id="tooltip-2" class="tooltip" popover="hint">Tooltip B</div> |
60 | | - <div id="tooltip-3" class="tooltip" popover="hint">Tooltip C</div> |
61 | 77 | </body> |
62 | 78 | </html> |
0 commit comments