cognitive-engineering-lab / rust-book

The Rust Programming Language: Experimental Edition
https://rust-book.cs.brown.edu
Other
502 stars 82 forks source link

Highlight feature not working on Firefox #93

Open VinWare opened 1 year ago

VinWare commented 1 year ago

URL to the section(s) of the book with this problem: https://rust-book.cs.brown.edu/

Description of the problem:

When trying to highlight text in Firefox (as indicated in the first page "Try highlighting this text"), on Firefox, the note popup comes up, but it gets stuck on submitting it. It does not close the popup, nor does it highlight the text. The popup can be closed by clicking outside of it, but this again does not highlight the text.

I have checked that highlighting works on Chromium, thus the issue is likely related to Firefox

User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/114.0

Suggested fix:

Without debugging, I am not sure of a fix. Perhaps a JS compatibility issue with Firefox may have caused it.

willcrichton commented 1 year ago

I could not reproduce this issue in FF 114 in latest macOS, so perhaps it's a Linux issue?

Can you check the Javascript console and see if there's any errors showing up?

Sniper296 commented 1 year ago

Same issue here. Firefox 115.0b5 Linux and Firefox 112.0.1 Windows.

I get the following error upon trying to submit the note:

 Uncaught TypeError: h is undefined
    c https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:35
    getDomMeta https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:35
    serialize https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:35
    _highlightFromHRange https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:35
    fromRange https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:35
    onClick https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:43
    A2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    P2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    L2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    r0 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    Iy https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    rp https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    $d https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    ey https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    rp https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    md https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    K2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    Py https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    np https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    Xl https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    Xl https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    JN https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    A1 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    N1 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    lA https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    _s https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    k0 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    io https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:25
    Dt https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    Dt https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    Pn https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    GN https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:25
    onClick https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:43
    A2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    P2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    L2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    r0 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    Iy https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    rp https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    $d https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:27
    ey https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    rp https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    md https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24
    K2 https://rust-book.cs.brown.edu/js-extensions/packages/feedback/dist/index.js:24

Firefox ETP, uBlock, and Privacy Badger all report no blocked resources. No 4xx or 5xx responses in the network tab.

willcrichton commented 1 year ago

Hmm I tried downloading the beta (FF 115) and it still worked. Seems like the problem is on all platforms except macOS? I'll find a Windows laptop to repro.

atsuzaki commented 10 months ago

@willcrichton I just ran into this in macOS, tripped on both FF116 and FF dev edition 117.

The exact error is Uncaught TypeError: can't access property "parentNode", h is undefined when submit is pressed, seems to be same as what these folks are encountering.