kamrify commited on
Commit
59d1882
·
1 Parent(s): 7b286e7

Non-animated driver to use shadows

Browse files
src/common/constants.js CHANGED
@@ -17,7 +17,7 @@ export const CLASS_DRIVER_HIGHLIGHTED_ELEMENT = 'driver-highlighted-element';
17
  export const CLASS_POSITION_RELATIVE = 'driver-position-relative';
18
  export const CLASS_FIX_STACKING_CONTEXT = 'driver-fix-stacking';
19
 
20
- export const CLASS_NO_ANIMATION = 'driver-no-animation';
21
  export const CLASS_POPOVER_TIP = 'driver-popover-tip';
22
  export const CLASS_POPOVER_TITLE = 'driver-popover-title';
23
  export const CLASS_POPOVER_DESCRIPTION = 'driver-popover-description';
 
17
  export const CLASS_POSITION_RELATIVE = 'driver-position-relative';
18
  export const CLASS_FIX_STACKING_CONTEXT = 'driver-fix-stacking';
19
 
20
+ export const CLASS_STAGE_NO_ANIMATION = 'driver-stage-no-animation';
21
  export const CLASS_POPOVER_TIP = 'driver-popover-tip';
22
  export const CLASS_POPOVER_TITLE = 'driver-popover-title';
23
  export const CLASS_POPOVER_DESCRIPTION = 'driver-popover-description';
src/core/overlay.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ANIMATION_DURATION_MS, CLASS_NO_ANIMATION, ID_OVERLAY, OVERLAY_HTML } from '../common/constants';
2
  import { createNodeFromString } from '../common/utils';
3
 
4
  /**
@@ -39,9 +39,15 @@ export default class Overlay {
39
  this.node.style.opacity = '0';
40
 
41
  if (!this.options.animate) {
42
- this.node.classList.add(CLASS_NO_ANIMATION);
43
- } else {
44
- this.node.classList.remove(CLASS_NO_ANIMATION);
 
 
 
 
 
 
45
  }
46
  }
47
 
 
1
+ import { ANIMATION_DURATION_MS, ID_OVERLAY, OVERLAY_HTML } from '../common/constants';
2
  import { createNodeFromString } from '../common/utils';
3
 
4
  /**
 
39
  this.node.style.opacity = '0';
40
 
41
  if (!this.options.animate) {
42
+ // For non-animation cases remove the overlay because we achieve this overlay by having
43
+ // a higher box-shadow on the stage. Why are we doing it that way? Because the stage that
44
+ // is shown "behind" the highlighted element to make it pop out of the screen, it introduces
45
+ // some stacking contexts issues. To avoid those issues we just make the stage background
46
+ // transparent and achieve the overlay using the shadow so to make the element below it visible
47
+ // through the stage even if there are stacking issues.
48
+ if (this.node.parentElement) {
49
+ this.node.parentElement.removeChild(this.node);
50
+ }
51
  }
52
  }
53
 
src/core/stage.js CHANGED
@@ -1,4 +1,4 @@
1
- import { CLASS_NO_ANIMATION, ID_STAGE, STAGE_HTML } from '../common/constants';
2
  import { createNodeFromString } from '../common/utils';
3
  import Element from './element';
4
 
@@ -34,9 +34,9 @@ export default class Stage extends Element {
34
  this.node = stage;
35
 
36
  if (!this.options.animate) {
37
- this.node.classList.add(CLASS_NO_ANIMATION);
38
  } else {
39
- this.node.classList.remove(CLASS_NO_ANIMATION);
40
  }
41
  }
42
 
 
1
+ import { CLASS_STAGE_NO_ANIMATION, ID_STAGE, STAGE_HTML } from '../common/constants';
2
  import { createNodeFromString } from '../common/utils';
3
  import Element from './element';
4
 
 
34
  this.node = stage;
35
 
36
  if (!this.options.animate) {
37
+ this.node.classList.add(CLASS_STAGE_NO_ANIMATION);
38
  } else {
39
+ this.node.classList.remove(CLASS_STAGE_NO_ANIMATION);
40
  }
41
  }
42
 
src/driver.scss CHANGED
@@ -4,10 +4,10 @@ $stage-bg: #ffffff;
4
  $button-bg: #f1f1f1;
5
  $disabled-btn-color: #808080;
6
 
7
- $popover-zindex: 1000000000;
8
- $overlay-zindex: 100002;
9
- $stage-zindex: 100003;
10
- $highlighted-element-zindex: 100004;
11
 
12
  // If you update this duration, make sure to
13
  // update `ANIMATION_DURATION_MS` constant
@@ -25,7 +25,7 @@ div#driver-popover-item {
25
  min-width: 250px;
26
  max-width: 300px;
27
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
28
- z-index: $popover-zindex;
29
 
30
  .driver-popover-tip {
31
  border: 5px solid $popover-bg;
@@ -124,12 +124,17 @@ div#driver-popover-item {
124
  }
125
  }
126
 
127
- .driver-no-animation {
128
  -webkit-transition: none !important;
129
  -moz-transition: none !important;
130
  -ms-transition: none !important;
131
  -o-transition: none !important;
132
  transition: none !important;
 
 
 
 
 
133
  }
134
 
135
  div#driver-page-overlay {
@@ -145,7 +150,7 @@ div#driver-page-overlay {
145
  zoom: 1;
146
  filter: alpha(opacity=75);
147
  opacity: 0.75;
148
- z-index: $overlay-zindex !important;
149
 
150
  -webkit-transition: all $animation-sec;
151
  -moz-transition: all $animation-sec;
@@ -161,8 +166,9 @@ div#driver-highlighted-element-stage {
161
  height: 50px;
162
  width: 300px;
163
  background: $stage-bg;
164
- z-index: $stage-zindex !important;
165
  display: none;
 
166
 
167
  -webkit-transition: all $animation-sec;
168
  -moz-transition: all $animation-sec;
@@ -172,7 +178,7 @@ div#driver-highlighted-element-stage {
172
  }
173
 
174
  .driver-highlighted-element {
175
- z-index: $highlighted-element-zindex !important;
176
  }
177
 
178
  .driver-position-relative {
 
4
  $button-bg: #f1f1f1;
5
  $disabled-btn-color: #808080;
6
 
7
+ $popover-z-index: 1000000000;
8
+ $overlay-z-index: 100002;
9
+ $stage-z-index: 100003;
10
+ $highlighted-element-z-index: 100004;
11
 
12
  // If you update this duration, make sure to
13
  // update `ANIMATION_DURATION_MS` constant
 
25
  min-width: 250px;
26
  max-width: 300px;
27
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.4);
28
+ z-index: $popover-z-index;
29
 
30
  .driver-popover-tip {
31
  border: 5px solid $popover-bg;
 
124
  }
125
  }
126
 
127
+ .driver-stage-no-animation {
128
  -webkit-transition: none !important;
129
  -moz-transition: none !important;
130
  -ms-transition: none !important;
131
  -o-transition: none !important;
132
  transition: none !important;
133
+
134
+ background: transparent !important;
135
+ -webkit-appearance: none;
136
+ -webkit-box-shadow: 0 0 0 50px rgba(0, 0, 0, 0.75);
137
+ box-shadow: 0 0 0 50px rgba(0, 0, 0, 0.75);
138
  }
139
 
140
  div#driver-page-overlay {
 
150
  zoom: 1;
151
  filter: alpha(opacity=75);
152
  opacity: 0.75;
153
+ z-index: $overlay-z-index !important;
154
 
155
  -webkit-transition: all $animation-sec;
156
  -moz-transition: all $animation-sec;
 
166
  height: 50px;
167
  width: 300px;
168
  background: $stage-bg;
169
+ z-index: $stage-z-index !important;
170
  display: none;
171
+ border-radius: 2px;
172
 
173
  -webkit-transition: all $animation-sec;
174
  -moz-transition: all $animation-sec;
 
178
  }
179
 
180
  .driver-highlighted-element {
181
+ z-index: $highlighted-element-z-index !important;
182
  }
183
 
184
  .driver-position-relative {