-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Buttons separators in RWD mobile should not be full height #8232
Conversation
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'm not sure about the approach, so I would double-check this with @oleq .
Apart from that 👍 for picking up tests in the right way for the added element.
@@ -24,6 +24,7 @@ import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler'; | |||
import checkIcon from '@ckeditor/ckeditor5-core/theme/icons/check.svg'; | |||
import cancelIcon from '@ckeditor/ckeditor5-core/theme/icons/cancel.svg'; | |||
import '../../theme/linkform.css'; | |||
import ToolbarSeparatorView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarseparatorview'; |
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.
This import should go alongside other code imports, preferably glued together with similar imports (ie after LabeledFieldVIew
import).
We like tidy imports :D
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.
right, corrected
@@ -85,6 +86,8 @@ export default class LinkFormView extends View { | |||
*/ | |||
this.cancelButtonView = this._createButton( t( 'Cancel' ), cancelIcon, 'ck-button-cancel', 'cancel' ); | |||
|
|||
this.separatorView = new ToolbarSeparatorView(); |
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 that this is not a good way to go. The ToolbarSeparatorView
is used (AFAIR for now) only inside the toolbar.
Maybe here we could just adjust buttons' CSS to achieve the required UI.
// cc @oleq
@@ -331,6 +334,7 @@ export default class LinkFormView extends View { | |||
} | |||
|
|||
children.add( this.saveButtonView ); | |||
children.add( this.separatorView ); |
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've fortgot to check that also the main view for the links needs update:
ckeditor5/packages/ckeditor5-link/src/ui/linkactionsview.js
Lines 127 to 131 in 45f40e5
children: [ | |
this.previewButtonView, | |
this.editButtonView, | |
this.unlinkButtonView | |
] |
Sorry for that - I've figured out this after looking how this behaves. So we heve here:
LinkActionsView
LinkFormView
margin-top: calc(var(--ck-spacing-large) + var(--ck-spacing-extra-tiny)); | ||
margin-bottom: var(--ck-spacing-small); |
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.
Something looks odd when I've tested it locally. See the screenshot for LinkFormView
.
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.
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.
Aside from the fact that the solution breaks in certain situations
I think this direction is a dead-end. Some more thoughts:
- The action buttons are not a toolbar so using
ToolbarSeparatorView
in this context is a no-go. - We cannot convert these buttons into a toolbar because... they are not a toolbar. Toolbars carry specific semantics and this is not the case.
- I'd see what we can do using
::before
or::after
pseudo-selectors for the buttons (pure CSS approach). For instance.ck-button::after
:
border-right: 1px solid var(--ck-color-base-border);
content: "";
width: 0;
position: absolute;
right: -1px;
top: var(--ck-spacing-small);
bottom: var(--ck-spacing-small);
z-index: 1;
results in something like this (ignore the broken toggle switches, it's just a PoC and I didn't narrow the selector)
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 mobile views are now OK 👍
However, the separator is now lost in manual decorators samples
PR | master |
---|---|
@oleq - Previously we had this style copied 3 times (I see 3 deletions in this PR). For a single line style, it doesn't look like a big overhead. Adding more properties means that we have to copy them in 3 places. Do we have any strategy or pattern for duplicated definitions?
Yeah. Normally we create a class and then it's shared across the use-cases. The story here is tricky, though because there's also the text alternative form that needs to be addressed and that means the styles must be shared across packages and cannot live in ckeditor5-link or ckeditor5-image. Some cake recipe (not sure it tastes good, though):
/* Either of responsiveform.css */
/* This one can be used here https://github.com/ckeditor/ckeditor5/blob/0706215c592edcf1b701b4af63298f4b77f8dd01/packages/ckeditor5-link/src/ui/linkformview.js#L139 */
/* It simply enforces the mode when the class is set. */
.ck-vertical-form some-sane-selector-that-reaches-the-correct-button::after {
/* Some CSS. */
}
/* This one is smart and works based on media queries. */
@mixin ck-media-phone {
.ck-responsive-form some-sane-selector-that-reaches-the-correct-button::after {
/* Same CSS as above. */
}
}
|
It would be lovely if you could manage to find time for that 😍 having those written down would also mean fewer pings from others 😉 |
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.
LGTM 👍 Only one request to @pkwasnik about documenting the button.ck-button
usage and we can merge it.
} | ||
} | ||
|
||
& button.ck-button { |
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.
@pkwasnik Could you add a comment on why there's button.ck-button
is needed. It wasn't obvious to me why this is needed.
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.
LGTM 👍
Suggested merge commit message (convention)
Fix (link): Implementing not full height separators. Closes #7704.
Additional information
For example – encountered issues, assumptions you had to make, other affected tickets, etc.