ChangeScreen2: Fix click inside of messages

Clicking within a message body should not collapse the message.  It
should have only the default browser behavior.

This is annoyingly obvious if a change message contains a hyperlink
and you click the link.  The message collapses but the link opens in a
new tab.  If the message had another link you also wish to follow, it
is necessary to first re-expand the message.

Move the click listener onto a new <div> that contains only the first
line (aka the header line), which is the natural click target.

Change-Id: Ic3398447df033aa69369c785166ba841f168a83d
(cherry picked from commit cd2fc945ae)
This commit is contained in:
Shawn Pearce
2013-11-19 15:52:23 -08:00
committed by David Pursehouse
parent 7aeed26213
commit b7368e94e0
2 changed files with 7 additions and 4 deletions

View File

@@ -41,6 +41,7 @@ class Message extends Composite {
}
@UiField Style style;
@UiField HTMLPanel header;
@UiField Element name;
@UiField Element summary;
@UiField Element date;
@@ -58,7 +59,7 @@ class Message extends Composite {
}
initWidget(uiBinder.createAndBindUi(this));
addDomHandler(new ClickHandler() {
header.addDomHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
setOpen(!isOpen());

View File

@@ -85,9 +85,11 @@ limitations under the License.
addStyleNames='{style.closed}'>
<c:AvatarImage ui:field='avatar' styleName='{style.avatar}'/>
<div class='{style.contents}'>
<g:HTMLPanel ui:field='header'>
<div class='{style.name}' ui:field='name'/>
<div ui:field='summary' class='{style.summary}'/>
<div class='{style.date}' ui:field='date'/>
</g:HTMLPanel>
<div ui:field='message'
aria-hidden='true'
style='display: NONE'/>