I could not force the style of the “button” element to look good in Confluence 7.11 (AUI 8.x):
I gave up on using a “button” element and went with an anchor “a” element like AUI 8.x uses and I added the aui-close-button style to it. Also, I had to eliminate the nested “span” in the anchor because that started rendering 2 X’s when the anchor “a” was styled for both AUI 8.x (aui-dialog-header-close) and AUI 9.x (aui-close-button).
Also had to inline styles on the anchor “a” so that it did not render as an ugly blue underlined X when hovered over.
This works in both Confluence 7.11.1 (AUI 8.x) and Confluence 7.12 beta1 (AUI 9.x) but it took me a few hours of hacking. We are finding lots of issues (probably related to AUI 9.x) while testing Confluence 7.12 beta1 with our plugins and I’m very concerned because:
- the migration guide is very small. I do not believe this is everything: AUI 9 upgrade guides - AUI Documentation
- this issue of closing dialog 2 dialogs is addressed in the migration guide but not in a backwards-compatible way. The suggested migration will break your app on AUI 8.x while making it work on 9.x
So, here is the solution I am going with, in case anyone runs into this and wants to save some time:
UPDATED CLOSE WIDGET (works for AUI 8.x and AUI 9.x):
<section role="dialog" id="includes-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" hidden persistent>
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">
{getText('biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro.multiexcerpt.dialog.title')}
</h2>
<a class="aui-close-button aui-dialog2-header-close" style="text-decoration:none;color:inherit;"
aria-label="{getText('biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro.multiexcerpt.dialog.close')}">
</a>
</header>
ORIGINAL CLOSE WIDGET (does not work for AUI 9.x):
<section role="dialog" id="includes-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" aria-hidden="true" persistent>
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">
{getText('biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro.multiexcerpt.dialog.title')}
</h2>
<a class="aui-dialog2-header-close">
<span class="aui-icon aui-icon-small aui-iconfont-close-dialog">Close</span>
</a>
</header>
Here is what it looks like in both Confluence 7.11 (AUI 8.x) and 7.12 (AUI 9.x):
… and it works in both versions, which was not happening before today.
I probably messed up the tab order of the widget and maybe have some other accessibility issues because I think one reason for AUI 9.x using “button” is for accessibility and to get tab order right automatically but I don’t have more days to spend on this.
I have a pile of other AUI 9 issues to address now that I’m bashing on Confluence 7.12 beta1. This first change was an eye-opener: the AUI migration guide is not giving migration advice that results in backwards-compatible code. I want my apps to work on both AUI 8.x and AUI 9.x and am not confident this is going to be possible as I make my way through the pile of issues I have waiting for me.
UPDATE:
and… that solution that works for AUI 8.x and AUI 9.x does not work at all for Confluence 6.15 (AUI 7.x). The Close widget is invisible in AUI 7.x, I need to add something (like “Close”) to the body of the “a” anchor for AUI 7.x
I want my app to support Confluence 6.x to Confluence 7.12 beta1 without having to write 2 or 3 different front ends and I don’t want to write branching logic based on Confluence/AUI version.
Back to the drawing board.
UPDATE:
I am back to using “button”. It looks bad in AUI 8.x and I’m opening a DEVHELP ticket for that. I think that is a bug in AUI.
It looks pretty bad in AUI 7.x too and I added a “title” attribute to the “button” element because it is a blank button in 7.x. and the title gives us hover text for free.
It only looks good in AUI 9.x but at least it is working in all 3 versions
AUI 7.x:
AUI 8.x:
AUI 9.x:
And here is the code. Yes, I tried putting “X” or “Close” in the body of button, in the body of an anchor when I was trying anchors… it looks worse than anything and that was abandoned:
<section role="dialog" id="includes-dialog" class="aui-layer aui-dialog2 aui-dialog2-medium" hidden persistent>
<header class="aui-dialog2-header">
<h2 class="aui-dialog2-header-main">
{getText('biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro.multiexcerpt.dialog.title')}
</h2>
// CMEP-271 - AUI 9.x upgrade - aui-close-button is for AUI 9.x, aui-dialog2-header-close is for AUI 8.x, title is for AUI 7.x
<button type="button" class="aui-close-button aui-dialog2-header-close"
aria-label="{getText('biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro.multiexcerpt.dialog.close')}"
title="{getText('biz.artemissoftware.confluence.multiexcerpt.MultiExcerptMacro.multiexcerpt.dialog.close')}"></button>
</header>