mgziminsky / FacebookTrackingRemoval

Browser extension that removes ads and the user interaction tracking from content on Facebook
GNU General Public License v3.0
122 stars 19 forks source link

Often breaks commenting on posts #37

Closed LosD closed 4 years ago

LosD commented 4 years ago

Describe the bug It seems that it sometimes breaks commenting on a post, no cursor appears in the comment field after clicking it when it happens.

To make sure FTR was the issue, I've tried enabling and disabling it, and when it is disabled (either the extension completely, or through the extension options), I never see the issue.

To Reproduce Steps to reproduce the behavior:

  1. Go to your Facebook wall.
  2. Go through comment fields, clicking each.
  3. Note if a cursor shows up, and if it is possible to enter text.

Actual behavior For some of them (maybe 25%), there is no cursor.

Expected behavior I expected a cursor showing up, and to be able to comment.

Screenshots image Red arrow shows where I try to click.

Please provide the following information:

Additional context Probably related to the hiding of an element close to the comment. A workaround used to be to click the date of the post instead, making it open by itself, then commenting often worked there. I can't get it to work now, my guess is that Facebook has changed tactics and shows the same elements when opened by itself.

mgziminsky commented 4 years ago

Thanks for reporting, I'll look into it more tomorrow, but I was unable to reproduce doing some quick checks just now. Would you also provide a screenshot of where exactly you are trying to click that isn't working in case I'm looking at the wrong thing.

LosD commented 4 years ago

Sure, updated comment. That post it happens for me every time, by the way: https://www.facebook.com/notes/sort-s%C3%B8ndag/playliste-uge-24-2020-sort-s%C3%B8ndag-med-m%C3%A5nedens-mesterv%C3%A6rk-mastodons-crack-the-sk/10158384431393637/

(I removed personal identifiable information from the screenshot, but I guess it doesn't really matter when it's a public post, especially when I then link the post 😄)

I guess it could be some kind of interaction with another extension. Are there any extensions you've seen issues with before? (edit: I tried disabling all other extensions, no change)

LosD commented 4 years ago

Just played around with the developer toolbar, and it seems they're using a <div> with the "Write a comment..." placeholder on top of a contenteditable <div>:

<div class="_7c-l">
    <div class=" _65td" contenteditable="true"></div>
    <div class="_7c-t FBTR-PROCESSED">Write a comment...</div>
</div>

If I delete the placeholder, I can comment.

Edit: Deleting unfortunately isn't a very good workaround (unless you're typing like a hurricane): After a few seconds, the whole text field disappears.

LosD commented 4 years ago

Original, without the extension active:

<div class="_5rp7">
    <div class="_1p1t">
        <div class="_1p1v" id="placeholder-8mjef" style="white-space: pre-wrap;">Write a comment...</div>
    </div>
    <div class="_5rpb">
        <div aria-describedby="placeholder-8mjef" aria-label="Write a comment..." class="notranslate _5rpu" contenteditable="true" role="textbox" spellcheck="true" style="outline: none; user-select: text; white-space: pre-wrap; overflow-wrap: break-word;">
            <div data-contents="true">
                <div class="" data-block="true" data-editor="8mjef" data-offset-key="7g7n7-0-0">
                    <div data-offset-key="7g7n7-0-0" class="_1mf _1mj">
                        <span data-offset-key="7g7n7-0-0">
                            <br data-text="true">
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

The major difference (beyond crap being removed) seems to be that the placeholder has been moved in front of the text field with the extension active. Guess some kind of event handler pass-through breaks sometimes?

If you need me to do some experiments, I'd be more than happy to oblige.

Edit: I tried shifting the placeholder <div> behind the other, but it didn't change anything until I changed the z-index to -1, which (of course) makes the placeholder disappear. That could be used as an, admittedly rather involved, workaround.

LosD commented 4 years ago

The example post stopped doing it. Others do it still. I guess it depends on what FB junk the extension needs to remove from the post at the time.

mgziminsky commented 4 years ago

Thanks for all that investigation. Unfortunately, I am still unable to reproduce myself.

<div class="_7c-l">
    <div class=" _65td" contenteditable="true"></div>
    <div class="_7c-t FBTR-PROCESSED">Write a comment...</div>
</div>

It's interesting that I never see this markup with the extension active, I always see your example from without the extension. Have you noticed any other similarities with the types of posts it breaks for? Are they only posts on your wall? A friends wall? In a group? etc...


The most likely issue is click events are being blocked and need whitelisted for the comment boxes. You can try confirming by enabling logging and seeing if you see something like the following in the dev console when you click the comment input:

Stopped propagation of mousedown from [object HTMLDivElement]
Stopped propagation of focus from [object HTMLDivElement]
Stopped propagation of focusin from [object HTMLDivElement]
Stopped propagation of mouseup from [object HTMLDivElement]
Allowed propagation of click from [object HTMLDivElement] to [object HTMLDivElement]
Stopped propagation of blur from [object HTMLDivElement]
Stopped propagation of focusout from [object HTMLDivElement]
Stopped propagation of focus from [object HTMLDivElement]
Stopped propagation of focusin from [object HTMLDivElement]
Stopped propagation of blur from [object HTMLDivElement]
Stopped propagation of focusout from [object HTMLDivElement]

That was taken directly from one of my comment fields. Strangely, it only happens on some of them for me, but it always works regardless. Notice the 5th line is an Allowed propagation. If the broken ones for you don't include the Allowed line, then that is likely the issue.

LosD commented 4 years ago

No, it seems to be random: sometimes friend's posts, sometimes group posts, and sometimes page posts. Doesn't seem to make a difference if it's from my own wall or others walls either.

I'll check with debugging on when I'm back at the computer.

LosD commented 4 years ago

Okaaaayyyy... I enabled the debugging, and the issue.... Simply disappeared. Disabled debugging and the issue is still gone.

The underlying issue is probably still there, but if it can't be reproduced, it can't be fixed. I'll close the issue and then reopen with a log if it shows up again. Thanks for the help (and the extension!).

LosD commented 4 years ago

Okay, it's back. And yeah, when I click on the comment box, I get:

Stopped propagation of mousedown from [object HTMLDivElement]
Stopped propagation of mouseup from [object HTMLDivElement]
Stopped propagation of click from [object HTMLDivElement]
mikeingz commented 4 years ago

Same problem for me. I can't comment in Group posts (but I can comment on friends' posts). I have to disable the option "Remove tracking from external links" to make it work again.

mgziminsky commented 4 years ago

Are you seeing the same problem as LosD, where clicking doesn't focus the input? Or are you seeing something else? Does it happen all the time, or in a predictable way, for you? Or is it seemingly random?

I have been unable to reproduce on my end so far, but I'll look into it more again this week.

mikeingz commented 4 years ago

The exact same problem as LosD, but only in facebook groups. And I have the same 3 "error" messages :

Stopped propagation of mousedown from [object HTMLDivElement] Stopped propagation of mouseup from [object HTMLDivElement] Stopped propagation of click from [object HTMLDivElement]

The only way for me to make it work, it's to insert an emoji first, then I can focus on the input and type. It's been like this for quite a long time actually.

mikeingz commented 4 years ago

Here is a short video:

facebookz

mgziminsky commented 4 years ago

Ok, i just made some progress. It appears that this is only an issue with the old/classic FB interface. I will look into fixing it, but if you have the option to switch to the new layout then doing so should get things working again. Another workaround is to click the "Comment" button on the post, which should give you keyboard focus on the input.

mgziminsky commented 4 years ago

Ok, should be fixed now. You will get the fix when the addon updates or you can click the "Refresh Rules" button under the advanced options to force it.