Updating a notification breaks the ui layout |
|||||
Issue description
Chrome Version: 70.0.3538.77
OS: Linux
What steps will reproduce the problem?
(1) Create a new Notification with a tag and empty title & body (new Notification('', {tag: 'tag', body: ''}))
(2) Update the Notification with a body (new Notification('', {tag: 'tag', body: 'body'}))
(3) Update the Notification with a title (new Notification('Title', {tag: 'tag', body: 'body'}))
What is the expected result?
A Notification on screen with the title in the first line, and the body below that.
What happens instead?
The title is at the very bottom of the Notification.
I assume this will also happen on older Windows systems, basically every system that does not use native notifications, though I've only tested on Linux.
This happens because the NotificationView only calls AddChildView on CreateOrUpdateTitleView and similar calls - and removes the views if the title is empty.
Instead, we need to keep the relative ordering of the UI elements of the Notifications.
,
Nov 8
,
Nov 8
,
Nov 14
Please provide a sample html testcase for reproducing the bug.
,
Nov 19
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/72954484ef1248e6f95e82f30c3be039a1c77b88 commit 72954484ef1248e6f95e82f30c3be039a1c77b88 Author: Richard Knoll <knollr@chromium.org> Date: Mon Nov 19 18:20:21 2018 fix: keep layout of notifications after updates This ensures that the layout of notifications is kept as intended. Bug: 901045 Change-Id: I0dcc92464a5751cd61ff7552824c57798aa73661 Reviewed-on: https://chromium-review.googlesource.com/c/1320169 Commit-Queue: Richard Knoll <knollr@chromium.org> Reviewed-by: Justin DeWitt <dewittj@chromium.org> Reviewed-by: Peter Beverloo <peter@chromium.org> Cr-Commit-Position: refs/heads/master@{#609356} [modify] https://crrev.com/72954484ef1248e6f95e82f30c3be039a1c77b88/ui/message_center/views/notification_view.cc [modify] https://crrev.com/72954484ef1248e6f95e82f30c3be039a1c77b88/ui/message_center/views/notification_view.h [modify] https://crrev.com/72954484ef1248e6f95e82f30c3be039a1c77b88/ui/message_center/views/notification_view_md.cc [modify] https://crrev.com/72954484ef1248e6f95e82f30c3be039a1c77b88/ui/message_center/views/notification_view_md.h [modify] https://crrev.com/72954484ef1248e6f95e82f30c3be039a1c77b88/ui/message_center/views/notification_view_md_unittest.cc [modify] https://crrev.com/72954484ef1248e6f95e82f30c3be039a1c77b88/ui/message_center/views/notification_view_unittest.cc
,
Nov 19
You can verify this on https://tests.peter.sh/notification-generator 1) Create a notification with title "Empty" and tag "tag-1" 2) Create a notification with title "Short sentence (LTR)" and tag "tag-1" After this, the title of the notification should be at the top of the notification view. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by robliao@google.com
, Nov 8