Skip to content

Commit

Permalink
fix(textchecker-element): apply patch for overflow bug
Browse files Browse the repository at this point in the history
apply patch from component/textarea-caret-position#56

```
text tex
t
```

In thie case, caret is buggy
  • Loading branch information
azu committed Jul 10, 2021
1 parent 266031f commit bc8f2c0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/textchecker-element/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
color: var(--c4);
background: var(--c2);
border: 0;
padding: 0.6em
padding: 0.6em;
}

button, input[type=submit], input[type=reset], input[type="button"] {
Expand Down
2 changes: 1 addition & 1 deletion packages/textchecker-element/src/text-checker-element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export class TextCheckerElement extends HTMLElement {
const startCoordinate = getCoordinates(this.targetElement, start, {
reuse: true,
returnHeight: true,
returnDiv: true,
returnDiv: false,
debug: false
});
// Stop to search if out of visible
Expand Down
7 changes: 4 additions & 3 deletions packages/textchecker-element/src/util/text-caret-pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ var properties = [
"borderRightWidth",
"borderBottomWidth",
"borderLeftWidth",
"borderStyle",
"borderTopStyle",
"borderRightStyle",
"borderBottomStyle",
"borderLeftStyle",

"paddingTop",
"paddingRight",
Expand Down Expand Up @@ -284,8 +287,6 @@ function styleCaretCoordinatesDiv(element, position, div, options) {
if (isFirefox) {
// Firefox lies about the overflow property for textareas: https://bugzilla.mozilla.org/show_bug.cgi?id=984275
if (element.scrollHeight > parseInt(computed.height)) style.overflowY = "scroll";
} else {
style.overflow = "hidden"; // for Chrome to not render a scrollbar; IE keeps overflowY = 'scroll'
}
}

Expand Down

0 comments on commit bc8f2c0

Please sign in to comment.