Skip to content

Commit

Permalink
feat: focus on hover if no document selection
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku committed Aug 16, 2022
1 parent d2cc0e7 commit 74f184f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions lib/core/Canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ Canvas.prototype._init = function(config) {

domAttr(svg, 'tabindex', 0);

eventBus.on('element.hover', function() {
if (document.activeElement === document.body) {
svg.focus();
}
});

svgAppend(container, svg);

var viewport = this._viewport = createGroup(svg, 'viewport');
Expand Down
6 changes: 4 additions & 2 deletions test/spec/features/bendpoints/BendpointsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,16 @@ describe('features/bendpoints', function() {

var bendpointContainer = domQuery('.djs-bendpoints', layer),
draggerGfx = bendpoints.getSegmentDragger(1, bendpointContainer),
draggerVisual = getVisual(draggerGfx),
oldBounds = draggerVisual.getBoundingClientRect();
draggerVisual = getVisual(draggerGfx);

// when
eventBus.fire('element.hover', {
element: connection,
gfx: elementRegistry.getGraphics(connection)
});

var oldBounds = draggerVisual.getBoundingClientRect();

eventBus.fire('element.mousemove', {
element: connection,
originalEvent: canvasEvent({ x: 250, y: 250 })
Expand Down

0 comments on commit 74f184f

Please sign in to comment.