Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invisible HTML prevents word detection #366

Closed
melink14 opened this issue Jan 9, 2021 · 4 comments · Fixed by #561
Closed

Invisible HTML prevents word detection #366

melink14 opened this issue Jan 9, 2021 · 4 comments · Fixed by #561
Assignees

Comments

@melink14
Copy link
Owner

melink14 commented Jan 9, 2021

rikaikun tries to flatten dom but in this case some weird auxillary hidden text has been added to facilitate some minor mini dictionary. Since they are considered text nodes, even if invisible they interrupt the word.

Part of this is the netflix language extension's poor grammar parsing but we could also try to ignore invisible elements...

<span data-token-index="6" data-word-key="WORD|絞る|ja" class="lln-word lln-hover-tooltip top">
  <span class="tt lln-tt-hidden" style="font-size: 21.8636px;">
    <span style="white-space: nowrap; opacity: 1;">squeeze</span><br />
    <span style="white-space: nowrap; opacity: 0.8;">wring</span>
  </span>
  絞っ
</span>
<span data-token-index="7" data-word-key="WORD|て|ja" class="lln-word lln-hover-tooltip top">
  <span class="tt lln-tt-hidden" style="font-size: 21.8636px;">
    <span style="white-space: nowrap; opacity: 1;">have</span>
  </span></span>
@melink14 melink14 added the bug label Jan 9, 2021
@melink14
Copy link
Owner Author

I wonder if I can give rikaikun the ability to delete content on demand.

@melink14
Copy link
Owner Author

or, automatically excluding hidden elements may work...

@melink14 melink14 self-assigned this Jun 26, 2021
@melink14 melink14 changed the title Multi-layered HTML prevents word detection Invisible HTML prevents word detection Jun 26, 2021
@melink14
Copy link
Owner Author

Will skip nodes which are display: none or visibility: hidden. We considered opacity: 0 but since you can still select and copy that hidden text it seems unlikely for it to be inserted into the middle of text.

melink14 added a commit that referenced this issue Jun 26, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

Fixes #366
melink14 added a commit that referenced this issue Jul 2, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

Fixes #366
melink14 added a commit that referenced this issue Jul 2, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: Jasmine + Karma + Headless Chrome.
Works with vscode debugging for fast test driven development.

Unrelated changes required for compilation:
- options.ts my LitToast interface needed to extend `Element` when
  compiling with karma and tsc. Not sure why it worked with `ts-loader`
- I needed to update webpack.config to accept a partial argv since of
  course we are only using `mode`.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 2, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: Jasmine + Karma + Headless Chrome.
Works with vscode debugging for fast test driven development.

Unrelated changes required for compilation:
- options.ts my LitToast interface needed to extend `Element` when
  compiling with karma and tsc. Not sure why it worked with `ts-loader`
- I needed to update webpack.config to accept a partial argv since of
  course we are only using `mode`.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 2, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: Jasmine + Karma + Headless Chrome.
Works with vscode debugging for fast test driven development.

Unrelated changes required for compilation:
- options.ts my LitToast interface needed to extend `Element` when
  compiling with karma and tsc. Not sure why it worked with `ts-loader`
- I needed to update webpack.config to accept a partial argv since of
  course we are only using `mode`.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 7, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 7, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 7, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 7, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 7, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 11, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

With --coverage flag, we get a coverage report that we can upload to
codecov.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 16, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

With --coverage flag, we get a coverage report that we can upload to
codecov.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 16, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

With --coverage flag, we get a coverage report that we can upload to
codecov.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 16, 2021
Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

With --coverage flag, we get a coverage report that we can upload to
codecov.

Fixes #366
Fixes #159
melink14 added a commit that referenced this issue Jul 16, 2021
…use (#561)

Specifically, ignore `display: none` and `visibility: hidden`.

This change is also the first unit tested change so contains the initial
configuration of testing. (See #159 for details on decisions).

Testing Stack: @web/test-runner + Mocha/Chai/Sinon + Puppeteer Headless Chrome.
Works with vscode debugging for fast test driven development.

With --coverage flag, we get a coverage report that we can upload to
codecov.

Fixes #366
Fixes #159
melink14 pushed a commit that referenced this issue Jul 17, 2021
## [2.0.0](v1.2.6...v2.0.0) (2021-07-17)

### ⚠ BREAKING CHANGES

* This version includes optional chaining requiring Chrome >=80

### Features

* Force Google Docs to use HTML mode instead of canvas mode ([#596](#596)) ([94b60a6](94b60a6)), closes [#593](#593)
* **detection:** Ignore invisible nodes when extracting text under mouse ([#561](#561)) ([cb97f36](cb97f36)), closes [#159](#159) [#366](#366) [#159](#159)

### Bug Fixes

* **dict:** Update dictionaries to latest versions. ([#581](#581)) ([77189c3](77189c3))
* Skip text processing when range is null ([#598](#598)) ([ae55bff](ae55bff)), closes [#386](#386)

### Code Refactoring

* Migrate from webpack to snowpack for build step ([#583](#583)) ([1bdd3d3](1bdd3d3))
@melink14
Copy link
Owner Author

🎉 This issue has been resolved in version 2.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant