-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Chrome: Rearrange the preview button in the header #845
Conversation
7d98816
to
3978632
Compare
Can you explain this? |
<Button href={ link } target="_blank"> | ||
<Dashicon icon="visibility" /> | ||
<IconButton | ||
href={ !! link ? link : undefined } |
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.
Was there a case where link
was not undefined
but not intended to be used as the href
to prompt this change?
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.
When I disable the button, the link is equal to ""
which triggers a a
and the pseudo-class disabled
don't work on links.
Visually I think this is great! Re: preview button being disabled — I don't have strong opinions, but I'm leaning towards us emulating the behavior in wp-admin currently, which is that you can preview even a completely empty post that hasn't even been saved yet. You won't see much, because there isn't anything to see, but that is what should be expected I suppose. |
Yes, this is temporary and I think we should do the same thing as the current wp-admin behaviour, Thought, I don't know how this works, I need details here. If the post is not saved yet, should I save it as a "draft" before opening the preview link. I don't think we have the API that allows us to save a revision or a post just to preview (like wp-admin does). |
Current behavior is that if a post isn't even saved, then it 404s on the frontend. Which is fine, because it doesn't exist yet :) |
This is not always true, if you type anything in the title/content, you'll see the post even if it's unsaved. |
Interesting. Well, in any case I'd defer to the simplest possible implementation, code wise, at this point. |
Yes, but not exactly in this order aince opening a new tab must occur in response to a user action (e.g. click), so cannot be delayed to wait for the save to complete. Instead, we'd open a new tab with We can defer this to a later pull request. |
editor/inserter/index.js
Outdated
@@ -75,7 +75,10 @@ class Inserter extends wp.element.Component { | |||
onClick={ this.toggle } | |||
className="editor-inserter__toggle" | |||
aria-haspopup="true" | |||
aria-expanded={ opened ? 'true' : 'false' } /> | |||
aria-expanded={ opened ? 'true' : 'false' } |
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.
Not specific to the scope of this pull request, but I wonder if React is smart enough to handle the boolean value without the ternary expression.
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.
Tried this and yes, React handles the boolean correctly. updating
Yaaazzz! |
closes #818
This PR tries to match the design in #818 (comment)
I also disabled the "preview" button when the post is not saved yet.