@hmcts/media-viewer 4.2.13 → 4.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Binary file
@@ -86,6 +86,17 @@ $button-border-color: #dee0e2;
86
86
  }
87
87
  }
88
88
 
89
+ #mvDrawBtn.toggled:not(:disabled),
90
+ #highlightTextBtn.toggled:not(:disabled) {
91
+ background-color: #f3f2f1;
92
+ box-shadow: inset 0 0 0 2px #ffdd00;
93
+ }
94
+
95
+ #mvDrawBtn.toggled:not(:disabled):hover,
96
+ #highlightTextBtn.toggled:not(:disabled):hover {
97
+ background-color: #f3f2f1;
98
+ }
99
+
89
100
  @media (max-width: 340px) {
90
101
  .redaction-button--draw,
91
102
  .redaction-button--redact,
@@ -1673,7 +1673,12 @@ class ToolbarEventService {
1673
1673
  }
1674
1674
  }
1675
1675
  toggleHighlightToolbar() {
1676
- this.highlightToolbarSubject.next(!this.highlightToolbarSubject.getValue());
1676
+ const isOpening = !this.highlightToolbarSubject.getValue();
1677
+ this.highlightToolbarSubject.next(isOpening);
1678
+ if (!isOpening) {
1679
+ this.highlightModeSubject.next(false);
1680
+ this.drawModeSubject.next(false);
1681
+ }
1677
1682
  }
1678
1683
  rotate(angle) {
1679
1684
  this.rotateSubject.next(angle);
@@ -1731,11 +1736,15 @@ class ToolbarEventService {
1731
1736
  }
1732
1737
  toggleRedactionMode() {
1733
1738
  if (this.redactionMode.getValue() === false) {
1739
+ this.highlightToolbarSubject.next(false);
1740
+ this.highlightModeSubject.next(false);
1734
1741
  this.drawModeSubject.next(false);
1735
1742
  this.grabNDrag.next(false);
1736
1743
  this.redactionMode.next(true);
1737
1744
  }
1738
1745
  else {
1746
+ this.highlightModeSubject.next(false);
1747
+ this.drawModeSubject.next(false);
1739
1748
  this.redactionMode.next(false);
1740
1749
  }
1741
1750
  this.openRedactionSearch.next({ modeType: SearchType.Redact, isOpen: false });
@@ -1996,12 +2005,20 @@ class HighlightCreateDirective {
1996
2005
  }
1997
2006
  }));
1998
2007
  this.$subscriptions.push(this.toolbarEvents.highlightModeSubject.pipe(filter(enabled => enabled && !!this.element.nativeElement), debounceTime(100)).subscribe(() => {
1999
- this.element.nativeElement.focus();
2008
+ this.focusWithoutScrolling(this.element.nativeElement);
2000
2009
  }));
2001
2010
  }
2002
2011
  ngOnDestroy() {
2003
2012
  this.$subscriptions.forEach(sub => sub.unsubscribe());
2004
2013
  }
2014
+ focusWithoutScrolling(element) {
2015
+ try {
2016
+ element.focus({ preventScroll: true });
2017
+ }
2018
+ catch {
2019
+ element.focus();
2020
+ }
2021
+ }
2005
2022
  onMouseUp(mouseEvent) {
2006
2023
  let page;
2007
2024
  let currentElement = mouseEvent.target;
@@ -4550,7 +4567,12 @@ class BoxHighlightCreateComponent {
4550
4567
  focusDrawingContainer() {
4551
4568
  setTimeout(() => {
4552
4569
  if (this.drawingContainer?.nativeElement && this.isElementInViewport(this.drawingContainer.nativeElement)) {
4553
- this.drawingContainer.nativeElement.focus();
4570
+ try {
4571
+ this.drawingContainer.nativeElement.focus({ preventScroll: true });
4572
+ }
4573
+ catch {
4574
+ this.drawingContainer.nativeElement.focus();
4575
+ }
4554
4576
  }
4555
4577
  }, 100);
4556
4578
  }
@@ -6895,20 +6917,28 @@ class ToolbarFocusService {
6895
6917
  if (buttonId) {
6896
6918
  const button = document.querySelector(`#${buttonId}`);
6897
6919
  if (button) {
6898
- button.focus();
6920
+ this.focusWithoutScrolling(button);
6899
6921
  return;
6900
6922
  }
6901
6923
  }
6902
6924
  if (element.tagName === 'BUTTON') {
6903
- element.focus();
6925
+ this.focusWithoutScrolling(element);
6904
6926
  return;
6905
6927
  }
6906
6928
  const tabbableButton = element.querySelector('button[tabindex="0"]');
6907
6929
  if (tabbableButton) {
6908
- tabbableButton.focus();
6930
+ this.focusWithoutScrolling(tabbableButton);
6909
6931
  }
6910
6932
  }, delay);
6911
6933
  }
6934
+ focusWithoutScrolling(element) {
6935
+ try {
6936
+ element.focus({ preventScroll: true });
6937
+ }
6938
+ catch {
6939
+ element.focus();
6940
+ }
6941
+ }
6912
6942
  /** @nocollapse */ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToolbarFocusService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
6913
6943
  /** @nocollapse */ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.3.16", ngImport: i0, type: ToolbarFocusService }); }
6914
6944
  }
@@ -7775,6 +7805,7 @@ class HighlightToolbarComponent {
7775
7805
  onClose() {
7776
7806
  this.toolbarEventService.highlightToolbarSubject.next(false);
7777
7807
  this.toolbarEventService.highlightModeSubject.next(false);
7808
+ this.toolbarEventService.drawModeSubject.next(false);
7778
7809
  this.toolbarEventService.openRedactionSearch.next({ modeType: SearchType.Highlight, isOpen: false });
7779
7810
  }
7780
7811
  onEscapeKey(event) {