aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/content/presenters/FollowPresenter.ts1
-rw-r--r--src/content/presenters/Hint.ts5
-rw-r--r--src/content/presenters/ScrollPresenter.ts25
-rw-r--r--src/settings/components/ui/Input.tsx2
4 files changed, 19 insertions, 14 deletions
diff --git a/src/content/presenters/FollowPresenter.ts b/src/content/presenters/FollowPresenter.ts
index 8aef819..e9105bc 100644
--- a/src/content/presenters/FollowPresenter.ts
+++ b/src/content/presenters/FollowPresenter.ts
@@ -11,6 +11,7 @@ const TARGET_SELECTOR = [
'[contenteditable=""]',
"[tabindex]",
'[role="button"]',
+ "[onclick]",
"summary",
].join(",");
diff --git a/src/content/presenters/Hint.ts b/src/content/presenters/Hint.ts
index 3f39060..8bf265b 100644
--- a/src/content/presenters/Hint.ts
+++ b/src/content/presenters/Hint.ts
@@ -119,7 +119,10 @@ export class InputHint extends Hint {
default:
if (doms.isContentEditable(target)) {
return target.focus();
- } else if (target.hasAttribute("tabindex")) {
+ } else if (
+ target.hasAttribute("tabindex") ||
+ target.hasAttribute("onclick")
+ ) {
return target.click();
}
}
diff --git a/src/content/presenters/ScrollPresenter.ts b/src/content/presenters/ScrollPresenter.ts
index f1a6402..a78e4ba 100644
--- a/src/content/presenters/ScrollPresenter.ts
+++ b/src/content/presenters/ScrollPresenter.ts
@@ -8,19 +8,21 @@ let scrolling = false;
let lastTimeoutId: number | null = null;
const isScrollableStyle = (element: Element): boolean => {
- const { overflowX, overflowY } = window.getComputedStyle(element);
+ const { overflowX, overflowY, overflow } = window.getComputedStyle(element);
return !(
overflowX !== "scroll" &&
overflowX !== "auto" &&
overflowY !== "scroll" &&
- overflowY !== "auto"
+ overflowY !== "auto" &&
+ overflow !== "scroll" &&
+ overflow !== "auto"
);
};
-const isOverflowed = (element: Element): boolean => {
+const doneScrolling = (element: Element): boolean => {
return (
- element.scrollWidth > element.clientWidth ||
- element.scrollHeight > element.clientHeight
+ element.scrollTop + element.clientHeight >= element.scrollHeight - 5 &&
+ element.scrollLeft + element.clientWidth >= element.scrollWidth - 5
);
};
@@ -29,7 +31,7 @@ const isOverflowed = (element: Element): boolean => {
// method is not cached. That does not cause performance issue because in the
// most pages, the window is root element i,e, documentElement.
const findScrollable = (element: Element): Element | null => {
- if (isScrollableStyle(element) && isOverflowed(element)) {
+ if (isScrollableStyle(element) && !doneScrolling(element)) {
return element;
}
@@ -44,12 +46,13 @@ const findScrollable = (element: Element): Element | null => {
};
const scrollTarget = () => {
- if (isOverflowed(window.document.documentElement)) {
- return window.document.documentElement;
- }
- if (isOverflowed(window.document.body)) {
- return window.document.body;
+ if (
+ window.document.scrollingElement &&
+ !doneScrolling(window.document.scrollingElement)
+ ) {
+ return window.document.scrollingElement;
}
+
const target = findScrollable(window.document.documentElement);
if (target) {
return target;
diff --git a/src/settings/components/ui/Input.tsx b/src/settings/components/ui/Input.tsx
index 6819ddb..0e24277 100644
--- a/src/settings/components/ui/Input.tsx
+++ b/src/settings/components/ui/Input.tsx
@@ -20,7 +20,6 @@ class Input extends React.Component<Props> {
<div className="settings-ui-input">
<label htmlFor={props.id}>{props.label}</label>
<input
- type="text"
className={inputClassName}
onChange={this.bindOnChange.bind(this)}
{...pp}
@@ -37,7 +36,6 @@ class Input extends React.Component<Props> {
<div className="settings-ui-input">
<label>
<input
- type="radio"
className={inputClassName}
onChange={this.bindOnChange.bind(this)}
{...pp}