From bbbc475cb25cdafbf82c21082d6113205a3f03d5 Mon Sep 17 00:00:00 2001 From: Topher Fangio Date: Fri, 18 Sep 2015 11:56:30 -0500 Subject: [PATCH] fix(fabSpeedDial): Make hovering an option via CSS. Initially, the speed dial was designed to always open when the user hovered over any portion of the speed dial (including the area where the actions would eventually appear). However, this made the speed dial unusable on mobile (and sometimes unusable on desktop) because it disallowed the user from pressing anything underneath the actions. * Add the `md-hover-full` CSS class to allow developer configuration of this behavior. * Ensure fabToolbar also works this way, and fix jumpy animation. * Also updated the docs/demos and made the demos easier to use on mobile. BREAKING CHANGE - The fabSpeedDial no longer automatically opens when hovering over the invisible actions. Add the `md-hover-full` class to enable this interaction. Fixes #4259. Closes #4847. --- .../fabSpeedDial/demoBasicUsage/index.html | 10 +- .../fabSpeedDial/demoMoreOptions/index.html | 126 ++++++++++-------- .../fabSpeedDial/demoMoreOptions/script.js | 22 ++- .../fabSpeedDial/demoMoreOptions/style.scss | 46 ++++++- src/components/fabSpeedDial/fabSpeedDial.js | 14 ++ src/components/fabSpeedDial/fabSpeedDial.scss | 21 ++- src/components/fabToolbar/fabToolbar.js | 34 ++--- 7 files changed, 176 insertions(+), 97 deletions(-) diff --git a/src/components/fabSpeedDial/demoBasicUsage/index.html b/src/components/fabSpeedDial/demoBasicUsage/index.html index 9bb877bb84c..4d78006f67b 100644 --- a/src/components/fabSpeedDial/demoBasicUsage/index.html +++ b/src/components/fabSpeedDial/demoBasicUsage/index.html @@ -29,7 +29,7 @@
-
+
Direction @@ -40,7 +40,7 @@
-
+
Open/Closed @@ -49,7 +49,7 @@
-
+
Animation Modes @@ -60,9 +60,5 @@
-

- Note that you can also hover over the directive's area or tab through each button to open and - activate the speed dial menu. -

diff --git a/src/components/fabSpeedDial/demoMoreOptions/index.html b/src/components/fabSpeedDial/demoMoreOptions/index.html index f51541e13bc..33ca6c73460 100644 --- a/src/components/fabSpeedDial/demoMoreOptions/index.html +++ b/src/components/fabSpeedDial/demoMoreOptions/index.html @@ -1,36 +1,68 @@
-

+ +

The speed dial supports many advanced usage scenarios. This demo shows many of them mixed - together. + together... and even includes a Toolbar - SpeedDial combination.

-
- - - - Menu - + +

+ Test + Test + Test + Test + Test + Test + Test +

+
+ + + + + Menu + + + + + +
+ + + {{item.name}} + + + - - - -
- - {{item.name}} - - -
-
- -
+
+ +
- -
+ +
+

Tooltips

+ +

+ Each action item supports a tooltip using the standard approach as can be seen above. +

+ +

ngHide

+ +

+ The speed dial also supports hiding using the standard ng-hide attribute. View + the source to see how to apply the animation effect. + + + Hide the speed dial. + +

+

ngRepeat

@@ -43,53 +75,39 @@

ngRepeat

that wraps your items.

-
-

$mdDialog

+ +
+

Hovering

- You can also use the buttons to open a dialog. When clicked, the buttons above will open a - dialog showing a message which item was clicked. + You can also easily setup the speed dial to open on hover using the + ng-mouseenter and ng-mouseleave attributes.

-
- - - -
-

ngHide

- The speed dial also supports hiding using the standard ng-hide attribute. + If you want the user to be able to hover over the empty area where the + actions will eventually appear, you must also add the + md-hover-full class to the speed dial element. - - Hide the speed dial. + + Enable "full hover" mode.

-
-
-

Tooltips

- Each action item supports a tooltip using the standard approach as can be seen above. + Notice that in "full hover" mode, you cannot click on the last "Test" buttons on the toolbar + as they are hidden by the speed dial. See the example code and docs for more information.

-
-
- - -
-

Hovering

-

- You can also easily setup the speed dial to open on hover using the - ng-mouseenter and ng-mouseleave attributes. -

+

$mdDialog

- See the example code for more information. + You can also use the buttons to open a dialog. When clicked, the buttons above will open a + dialog showing a message which item was clicked.

-