Skip to content

Commit

Permalink
#2207 Scrollbar for WYSIWYG annotation note can not be clicked to scr…
Browse files Browse the repository at this point in the history
…oll (#2208)

Signed-off-by: CTomlyn <[email protected]>
  • Loading branch information
tomlyn authored Oct 15, 2024
1 parent 9ed6d70 commit 958067f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
37 changes: 12 additions & 25 deletions canvas_modules/common-canvas/src/common-canvas/svg-canvas-d3.scss
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,6 @@ $link-highlight-color: $support-info;
overflow: visible;
}

.d3-foreign-object-comment-text {
// Don't handle events - let objects inside foreign object handle them.
pointer-events: none;
overflow: hidden;
}

// Declare our own focus highlighting for text entry.
@mixin d3-text-entry-focus-mixin {
// Supress the default focus highlighting with non-carbon color and round corners.
Expand Down Expand Up @@ -923,7 +917,6 @@ g.bkg-col-cyan-50 {
word-break: break-word;
}

/* Style for comment text entry when shown in an HTML textarea control. */
.d3-comment-text-scroll,
.d3-comment-text-entry-scroll {
pointer-events: unset;
Expand All @@ -934,47 +927,41 @@ g.bkg-col-cyan-50 {
border-style: solid;
height: 100%;
width: 100%;
scrollbar-color: $layer-active-02 $layer-02;
}

.d3-comment-text-outer {
.d3-comment-text-outer,
.d3-comment-text-entry-outer {
display: table;
pointer-events: none;
overflow: hidden;
width: 100%;
height: 100%;
outline: none;
}

.d3-comment-text {
.d3-comment-text,
.d3-comment-text-entry {
@include d3-comment-mixin;
background-color: $comment-fill-color;
padding: $comment-text-display-border;
border-width: $comment-border-width;
background-color: $comment-fill-color;
outline: none;
user-select: none;
overflow: hidden;
display: table-cell;

// Only applicable to d3-comment-text
&.markdown {
@include d3-comment-markdown;
}
}

.d3-comment-text-entry-outer {
display: table;
pointer-events: none;
overflow: hidden;
width: 100%;
height: 100%;
outline: none;
.d3-comment-text {
cursor: default;
}

.d3-comment-text-entry {
@include d3-comment-mixin;
padding: $comment-text-display-border;
border-width: $comment-border-width;
background-color: $field-01;
outline: none;
user-select: none;
overflow: hidden;
display: table-cell;
cursor: text;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,12 @@ export default class SvgCanvasTextArea {
this.foreignObjectComment
.append("xhtml:div") // Provide a namespace when div is inside foreignObject
.attr("class", "d3-comment-text-entry-scroll")
.on("mousedown", (d3Event) => {
// This is triggered when the user 'mousedown's on the scrollbar. In this
// case, prevent propogation otherwise it causes a 'blur' event and ends
// the edit mode.
CanvasUtils.stopPropagationAndPreventDefault(d3Event);
})
.each((d, i, commentTexts) => {
const commentElement = d3.select(commentTexts[i]);
CanvasUtils.applyOutlineStyle(commentElement, d.formats); // Only apply outlineStyle format here
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Cypress.Commands.add("moveCommentToPosition", (commentText, canvasX, canvasY) =>
.then((transform) => {
cy.window().then((win) => {
cy.get(srcSelector)
.trigger("mousedown", "topLeft", { which: 1, view: win });
.trigger("mousedown", "topLeft", { which: 1, view: win, force: true });
cy.get("#canvas-div-0")
.trigger("mousemove", canvasX + transform.x, canvasY + transform.y, { view: win });
cy.get("#canvas-div-0")
Expand Down

0 comments on commit 958067f

Please sign in to comment.