Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Actively set focus on canvas

Oliver Günther006e1b46824c
diff --git a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
index 794b21c0c78..4c61bf07ddb 100644
--- a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
+++ b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.html
@@ -25,7 +25,8 @@
</div>
<div class="ifc-model-viewer--toolbar-container"></div>
- <canvas class="ifc-model-viewer--model-canvas"
+ <canvas #modelCanvas
+ class="ifc-model-viewer--model-canvas"
tabindex="0">
</canvas>
</div>
diff --git a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.sass b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.sass
index 45d8b4b3482..76454e032ca 100644
--- a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.sass
+++ b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.sass
@@ -31,6 +31,9 @@
width: 100%
height: 100%
+ &:focus
+ outline: none
+
.ifc-model-viewer--focus-warning
@include without-link-styling
position: absolute
@@ -39,4 +42,3 @@
.ifc-model-viewer--keyboard-disabled-icon
font-size: 20px
-
diff --git a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts
index 988bee630e9..30490dcc087 100644
--- a/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts
+++ b/frontend/src/app/modules/bim/ifc_models/ifc-viewer/ifc-viewer.component.ts
@@ -61,6 +61,7 @@ export class IFCViewerComponent implements OnInit, OnDestroy {
keyboardEnabled = false;
@ViewChild('outerContainer') outerContainer:ElementRef;
+ @ViewChild('modelCanvas') modelCanvas:ElementRef;
constructor(private I18n:I18nService,
private elementRef:ElementRef,
@@ -108,6 +109,9 @@ export class IFCViewerComponent implements OnInit, OnDestroy {
enableFromIcon(event:MouseEvent) {
this.enableKeyBoard();
+ // Focus on the canvas
+ this.modelCanvas.nativeElement.focus();
+
// Ensure we don't bubble this event to the window:mousedown handler
// as the target will already be removed from the DOM by angular
event.stopImmediatePropagation();