diff --git a/src/lib/Preview.js b/src/lib/Preview.js
index 6cbfef2c1..a71b71da7 100644
--- a/src/lib/Preview.js
+++ b/src/lib/Preview.js
@@ -1876,7 +1876,7 @@ class Preview extends EventEmitter {
// Ignore key events when we are inside certain fields
if (
!target ||
- (KEYDOWN_EXCEPTIONS.indexOf(target.nodeName) > -1 && !target.getAttribute('data-allow-keydown')) ||
+ KEYDOWN_EXCEPTIONS.indexOf(target.nodeName) > -1 ||
(target.nodeName === 'DIV' && !!target.getAttribute('contenteditable'))
) {
return;
diff --git a/src/lib/__tests__/Preview-test.js b/src/lib/__tests__/Preview-test.js
index 6962447e8..2f27bd913 100644
--- a/src/lib/__tests__/Preview-test.js
+++ b/src/lib/__tests__/Preview-test.js
@@ -2762,15 +2762,6 @@ describe('lib/Preview', () => {
expect(stubs.event.preventDefault).not.toBeCalled();
});
- test('should pass the event to the viewer if the target is an input but allows keydown handling', () => {
- stubs.decodeKeydown.mockReturnValue('M');
- stubs.event.target.getAttribute = jest.fn(() => true); // data-allow-keydown=true
- preview.viewer.onKeydown = jest.fn(() => true);
- preview.keydownHandler(stubs.event);
-
- expect(preview.viewer.onKeydown).toBeCalledWith('M', stubs.event);
- });
-
test('should navigate left is key is ArrowLeft and the event has not been consumed', () => {
preview.viewer.onKeydown = jest.fn(() => false);
stubs.event.target.nodeName = 'ArrowLeft';
diff --git a/src/lib/viewers/controls/media/TimeControls.scss b/src/lib/viewers/controls/media/TimeControls.scss
index 52d699dc9..585f795c6 100644
--- a/src/lib/viewers/controls/media/TimeControls.scss
+++ b/src/lib/viewers/controls/media/TimeControls.scss
@@ -1,35 +1,31 @@
-@import '../slider/styles';
-
-$bp-TimeControls-size: 18px; // Divisible by 3px (default) and 6px (hovered) for better vertical centering
-$bp-TimeControls-space: 10px;
+@import '../styles';
.bp-TimeControls {
- height: $bp-TimeControls-size;
+ position: relative;
+ margin-right: 10px;
+ margin-left: 10px;
+}
- .bp-SliderControl-input {
- padding-right: $bp-TimeControls-space;
- padding-left: $bp-TimeControls-space;
+.bp-TimeControls-slider {
+ height: 18px; // Divisible by 3px (default) and 6px (hovered) for better vertical centering
- @include bp-SliderThumb {
- transform: scale(0);
- transition: transform 100ms ease;
- will-change: transform; // Prevent flickering in Safari
- }
+ .bp-SliderControl-thumb {
+ transform: scale(0);
+ transition: transform 100ms ease;
+ will-change: transform; // Prevent flickering in Safari
}
.bp-SliderControl-track {
- margin-right: $bp-TimeControls-space;
- margin-left: $bp-TimeControls-space;
backface-visibility: hidden; // Prevent jank in Firefox
transition: transform 100ms ease;
will-change: transform; // Prevent flickering in Safari
}
+ &.bp-is-scrubbing,
+ &:focus,
&:hover {
- .bp-SliderControl-input {
- @include bp-SliderThumb {
- transform: scale(1);
- }
+ .bp-SliderControl-thumb {
+ transform: scale(1);
}
.bp-SliderControl-track {
diff --git a/src/lib/viewers/controls/media/TimeControls.tsx b/src/lib/viewers/controls/media/TimeControls.tsx
index 91d7fdbfa..75d95ad30 100644
--- a/src/lib/viewers/controls/media/TimeControls.tsx
+++ b/src/lib/viewers/controls/media/TimeControls.tsx
@@ -25,22 +25,24 @@ export default function TimeControls({
durationTime = 0,
onTimeChange,
}: Props): JSX.Element {
- const currentValue = isFinite(currentTime) && isFinite(durationTime) ? percent(currentTime, durationTime) : 0;
+ const currentValue = isFinite(currentTime) ? currentTime : 0;
+ const durationValue = isFinite(durationTime) ? durationTime : 0;
+ const currentPercentage = percent(currentValue, durationValue);
const bufferedAmount = bufferedRange && bufferedRange.length ? bufferedRange.end(bufferedRange.length - 1) : 0;
- const bufferedValue = percent(bufferedAmount, durationTime);
-
- const handleChange = (newValue: number): void => {
- onTimeChange(round(durationTime * (newValue / 100)));
- };
+ const bufferedPercentage = percent(bufferedAmount, durationValue);
return (
-