From d9d5d3392c33ea1c7d67cae0e1fcd1d25ba4c4e5 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. --- .../fabSpeedDial/demoBasicUsage/index.html | 6 +- .../fabSpeedDial/demoMoreOptions/index.html | 127 ++++++++++-------- .../fabSpeedDial/demoMoreOptions/script.js | 22 ++- .../fabSpeedDial/demoMoreOptions/style.scss | 38 +++++- src/components/fabSpeedDial/fabSpeedDial.js | 14 ++ src/components/fabSpeedDial/fabSpeedDial.scss | 21 ++- src/components/fabToolbar/fabToolbar.js | 34 ++--- 7 files changed, 169 insertions(+), 93 deletions(-) diff --git a/src/components/fabSpeedDial/demoBasicUsage/index.html b/src/components/fabSpeedDial/demoBasicUsage/index.html index 9bb877bb84c..22e0c28d1d9 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 diff --git a/src/components/fabSpeedDial/demoMoreOptions/index.html b/src/components/fabSpeedDial/demoMoreOptions/index.html index f51541e13bc..40d799c41fd 100644 --- a/src/components/fabSpeedDial/demoMoreOptions/index.html +++ b/src/components/fabSpeedDial/demoMoreOptions/index.html @@ -1,36 +1,69 @@
+ + +

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

+
+

- The speed dial supports many advanced usage scenarios. This demo shows many of them mixed - together. + The speed dial supports many advanced usage scenarios. +
+ This demo shows many of them mixed together.

-
- - - - Menu - + + + + 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 +76,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.

-