status-desktop/ui/app/AppLayouts/Chat
Pascal Precht e1a4a47636 fix(Chat): disable HoverHandler when profile popup or context menu are open
Alright, this is an interesting one:

As described in #1829, when the profile popup is opened within the chat view,
users are still able to click *through* the popup on message, which then puts them in
an active state.

I've done a bunch of debugging as described [here](https://github.com/status-im/status-desktop/issues/1829#issuecomment-804748148) and after doing some
further debugging, I found out that `isMessageActive` isn't really the culprit here.

What causes this effect is the `HoverHandler` that's attached to the `CompactMessage` item.
`HoverHandler` is a standard QML type that emits `hoverChanged` signals so one can do things like
applying hover effects on elements, which is exactly what we do:

```
HoverHandler {
  onHoverChanged: {
    root.isHovered = hovered  // `root` being the message item
  }
}
```

I assume we went with this handler because putting a `MouseArea` in there instead, which fills
the entire message component pretty much eliminates all existing mouse handlers attached to
other child components, such as the profile image or the username of the message, which also
open a message context menu.

It turns out that, having a `HoverHandler` as described above, actually activates it when the
user clicks with the left mouse button as well (not just on hover). That's what causes the "click-through"
effect. This can be verified by setting `acceptedButtons` to `Qt.RightButton`, basically telling
the handler that only right clicks will activate it.

I then tried using `Qt.NoButtons` instead so that no button clicks and only hovers will activate
the handler, but that didn't seem to have any effect at all. It still defaults to `Qt.LeftButton`.

So the last resort was to disable the `HoverHandler` altogether, whenever either the profile popup,
or the message context menu (for emojis etc) is open.

Unfortunately, we don't have access to the profile popup in the compact message component, because it's
detached from the component tree. Therefore, I've introduced a new property `profilePopupOpened` on
the chat layout, which we can read from instead.

Fixes #1829
2021-03-23 10:32:31 -04:00
..
ChatColumn fix(Chat): disable HoverHandler when profile popup or context menu are open 2021-03-23 10:32:31 -04:00
CommunityComponents chore: hide edit community button until the feature is implemented 2021-03-18 14:52:28 -04:00
ContactsColumn fix: fix a lot of issues relative to dark theme 2021-03-16 17:22:58 -04:00
components feat(PrivateChatPopupSearchResults): introduce reset() and config API 2021-03-22 15:49:47 -04:00
data change status-spanish to status-espanol, it's more guay 2020-09-23 17:19:17 -04:00
ChatColumn.qml feat: drag and drop images 2021-03-16 13:51:37 -04:00
ChatLayout.qml fix(Chat): disable HoverHandler when profile popup or context menu are open 2021-03-23 10:32:31 -04:00
CommunityColumn.qml fix: fix a lot of issues relative to dark theme 2021-03-16 17:22:58 -04:00
ContactsColumn.qml feat: implement redesign of communities on the left tab 2021-03-03 16:45:23 -05:00
qmldir feat(chat): implement mention auto complete 2020-07-17 12:31:20 -04:00