-
-
Notifications
You must be signed in to change notification settings - Fork 554
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XWIKI-21452: Macros info, success, warning and error are only distinguished by colors #2590
Conversation
…uished by colors * Updated style to take into account the addition of an icon in xwiki-rendering
Thanks for the updated screenshot. The separation between the title and the text is not very clear. I think we already have a jira issue about this (for the box macro since this is what is used underneath). I know this not your topic though and not really related to accessibility ;) |
Yes, the styling of the title itself is the subject of another issue, I mainly wanted to see the placement of the icon compared to the title. Thanks, @Sereza7. |
…uished by colors * Updated style to differentiate the title from the content of the box
I can add a couple CSS rules to fix that in this PR ^^ |
Hi, I've done some mockups to test a better separation between elements. I don't know yet the difference between the small version and the big one on your screenshots, but I called them big and compact :) Some callouts have titles, others don't, just to check different versions. I think it's important to maintain the horizontal padding consistent, so we can have better alignment between the two versions, as we can see below. Also, from the screenshot you can see that maintaining the text in its own box can help improve legibility as the beginning of the text line always start at the same vertical point. If we could use Font Awesome it would be... well... awesome. The Silk iconset is pretty dated and, being a PNG, it does not render very well on a Hi Dpi monitor; |
It's "inline" (when the macro is in the middle of a paragraph, for example) and "standalone" (completely isolated). |
Big -> Regular macro, box with a message inside. You need to make sure you have an empty line before and after the macro. For reference here is the xwiki 2.1 syntax I used to generate the page in my screenshot.
How did you manage to get that style with the current HTML? I'm only seeing more and more style hacks we need to perform because there's a lack of container for the title. I'll add a container and update this PR soon so the style implementation can be more straightforward/stable.
Unfortunately in this context we can't use font-awesome without a lot more work (see xwiki/xwiki-rendering#286 ). It's actually not that bad here because the icons have approximately the same colors as the blocks. IMO it's way worst with transformation icons for example. Setting this PR as a draft until I add a container for the title, set up vertical alignment and update padding :) |
Those are only mockups, but the alignment should be doable with an absolute positioning of the icon inside a relative positioned container for the message or even better with a flex layout; Regarding the title, yeah, a container would help to achieve this effect without hacks on the CSS.
No problem. Edit: I forgot to address your first comment
No problem, disregard my compact version then |
What about long messages without title? Would you indent them the same way as with title? |
If they have icons before them, then yes. I don't know if there will be support from now on for messages without the icons, but if that's the case, then the text aligns normally with the message box, as it is today; Example expanded with more options |
…uished by colors * Updated style to align text in the box with a grid. Note: we don't know the exact height we want for this box (depends on content), so we can't use a column flexbox.
…uished by colors * Cleaned up style
…uished by colors * Updated padding and icon position for a cleaner presentation
…uished by colors * Fixed width of the boxes fitted to content and icon alignement
…uished by colors * Fixed presentation for inplace editing
Fixed the presentation for inplace editing in d6ed654 : Inplace editing wraps the nodes we expected to be in the message box in a layer of CKEditor nodes. I added a selector to apply the same style to those CKEditor nodes as the one applied on the base nodes. |
This doesn't follow the styles proposed by @tkrieck - is there any reason for it? In particular, the icons have way less spacing to the border and are not on the same line as the text when there is no title. This looks very strange in my opinion. What @tkrieck looks much better in my opinion. Also, I'm really not happy with introducing silk icons here. Even if we replace these icons by SVG icons from Font Awesome, this won't look good as they won't have the text color. I'm really wondering if it wouldn't be better to either add better icon support to |
Here is a side by side comparison of the two for easier assessment of the difference Here is an example much closer to the styles proposed by tkrieck. In my opinion, especially on multi line blocks, having such a large column just to fit an icon that is non essential to understanding the content for most users looks overkill.
In my opinion, the icon floating in the middle of the left column didn't look pretty on large blocks of text, mostly because sometimes it didn't line up with the line next to it. So I decided to go with the choice to keep it consistently in the same place whether or not there's a title for the block. I think it's good because it emphasizes that the icon is related to the block itself and not its content.
IMO overriding those is probably easier but also worse for long term technical debt. |
…uished by colors * Implementing the IconProvider interface to override xwiki-rendering behavior TODO: use a similar code to the icon nacro to provide the raw content of the block
…uished by colors * Implemented an alternative to isntantiate icons in rendering * Updated the POM * Fixed the components.txt file Note: I decided to not factorize witht the code in the DisplayIconMacro because we don't need anything related to a parameter.
Nice! I haven't followed closely so the question might have been answered earlier but why isn't the icon aligned with the first line when the macro does not have a title? |
@manuelleduc |
…uished by colors * Started reflecting changes from rendering
…uished by colors * Updated position of the IconProvider to match the changes in rendering * Updated the return type of the iconProvider
Addressed in d906315 👍 I rebuilt all of the necessary modules successfully, and here is the result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, overall this looks good just some updates to be done after the changes to the corresponding PR in xwiki-rendering.
where we fall back on the default behaviour (the current icon theme does not have | ||
the requested icon). | ||
*/ | ||
private static final List<Class> ICON_CLASS = new ArrayList<Class>(List.of(RawBlock.class, ImageBlock.class)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 341b4d9 👍
/** | ||
* @return the java class of the icon block created. | ||
*/ | ||
public List<Class> getIconClass() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this method should be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 341b4d9 👍
try { | ||
iconSet = getIconSet(iconName); | ||
String iconContent = this.iconRenderer.renderHTML(iconName, iconSet); | ||
return new IconBlock(List.of(new RawBlock(iconContent, Syntax.HTML_5_0))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you should adopt my suggestion to remove IconBlock
from the API, this needs to be adjusted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed in 341b4d9 👍
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | ||
* 02110-1301 USA, or see the FSF site: http://www.fsf.org. | ||
*/ | ||
package org.xwiki.rendering.internal.transformation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in a transformation
package? This is not really related to transformations anymore I think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The DefaultIconProvider
from xwiki-rendering
is in a transformation package. I want to inherit this class which is internal, so I figured I'd put it in the same package.
Moreover, there's no real place where this would suit perfectly, the best I could find from a quick look would be org.xwiki.rendering.internal.util
.
For reference, the classes XWikiHTMLRawBlockFilter
and XWikiErrorBlockGenerator
are in a similar situation.
I'm not very confident in this choice, let me know where you'd put it instead.
Taking a look to see if it would make sense to fit the DefaultIconProvider
in utils, and move this one afterwards. 👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From what I can see, there's no dependency anymore to anything in the transformation package, so I'll be moving those classes to util
and updating the components.txt
files :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move done in e1dfba5 👍
* Updated the XWikiIconProvider class to fit the changes on `platform`.
…uished by colors * Updated the position of the XWikiIconProvider to reflect the move in `xwiki-rendering`. Now in the `util` package instead of being in the `transformation` package.
Changes since #2590 (review):
TestsAfter e1dfba5 and making sure all the changes in
|
…uished by colors * Updated the `since` value
…uished by colors * in the inline version, reduced the white space between the border and the icon
TODO: Add a sr-only alternative for the icon See https://forum.xwiki.org/t/updating-the-presentation-of-message-macros/13872/15?u=charpentierlucas |
…uished by colors * Added a text alternative to the icons provided for boxes * Added default translations for the box icons. * Updated release numbers for master branch Note: This does not have any visual effect, but facilitates things for screen readers.
Added a text alternative for icons in the messages in 655cc72. Those text alternatives are not needed for any visual users, so I decided to leave them as Waiting for the CSS update to set back this PR status as |
…uished by colors * Changed margins and gaps between icon and borders * Removed borders from the message macro * Removed box shadow from the message macro * Added a visually distinguished left border to each type of message
I did the changes discussed in this topic with the proposed solution. |
…uished by colors * Factorized some style * Added a space on the line `border: none`
@tkrieck I brought small codestyle fixes in 4e5bee5 :
|
Got it, thank you! |
Jira
https://jira.xwiki.org/browse/XWIKI-21452
PR Changes
Tests
No specific test since this is just style changes
View
Video demo to check out responsivisity of these style changes
Note
This PR should be merged on main, only after the appropriate changes have been merged on xwiki-rendering -> xwiki/xwiki-rendering#286 .