Skip to content

fix(aio): improve heading-anchor placement - #16336

Closed
petebacondarwin wants to merge 4 commits into
angular:masterfrom
petebacondarwin:aio-anchor-link-placement
Closed

petebacondarwin wants to merge 4 commits into
angular:masterfrom
petebacondarwin:aio-anchor-link-placement

Conversation

@petebacondarwin

@petebacondarwin petebacondarwin commented Apr 26, 2017 •

Copy link
Copy Markdown
Contributor

No description provided.

@mary-poppins

Copy link
Copy Markdown

The angular.io preview for ad70ba06950170b67f9e069dfd1e6a724ecaf1a3 is available here.

@gkalpak

gkalpak commented Apr 26, 2017

Copy link
Copy Markdown
Member

docs_test fails (it seems that some assertions need to be updated).

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

Good old tests :-)

@petebacondarwin
petebacondarwin force-pushed the aio-anchor-link-placement branch from ad70ba0 to 2eb8cf9 Compare April 26, 2017 08:44
@petebacondarwin

Copy link
Copy Markdown
Contributor Author

Fixed the tests.

@petebacondarwin petebacondarwin added the action: review The PR is still awaiting reviews from at least one requested reviewer label Apr 26, 2017
@gkalpak

gkalpak commented Apr 26, 2017

Copy link
Copy Markdown
Member

Not super-excited about having them on the right, but other than that it LGTM (as long as Travis is happy).

@mary-poppins

Copy link
Copy Markdown

The angular.io preview for 2eb8cf91b5489990e32bbf403c645fa35ab9e8ff is available here.

@petebacondarwin petebacondarwin added state: WIP and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 26, 2017
@petebacondarwin
petebacondarwin force-pushed the aio-anchor-link-placement branch from 2eb8cf9 to ad27107 Compare April 26, 2017 09:38
@petebacondarwin

Copy link
Copy Markdown
Contributor Author

I noticed that @sjtrimble's new PR (#16327) puts a heading anchor on the far right (and doesn't make it invisible when not hovering. This may have been my accident but it looked quite nice.
So I have updated this PR to achieve the same across all headings.

(I also took this as an opportunity to fix the concern that @gkalpak had about the absolute positioning of icons by a generic CSS rule was too broad).

Let me know what you think.

@mary-poppins

Copy link
Copy Markdown

The angular.io preview for ad27107e356032f2474c204dcf84b974f0cdb0ad is available here.

@gkalpak

gkalpak commented Apr 26, 2017

Copy link
Copy Markdown
Member

I am not a huge fan of far-right, always-visible anchors (but I can live with that if we can't find a better solution).

Here's another idea:
If the cases where there is a bordered parent (that messs with the left-side anchor) are limited to a couple known ones, maybe it is worth keeping the left-side anchors (possibly keeping them visible with low opacity when not hovered to make them more discoverable) and special-cases the few situations where there are bordered parents (via CSS styles).

@gkalpak gkalpak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation-wise LGTM (with the tests fixed) 👍

@petebacondarwin

petebacondarwin commented Apr 26, 2017 via email

Copy link
Copy Markdown
Contributor Author

Comment thread aio/src/styles/2-modules/_code.scss Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be right: 0.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.

@gkalpak

gkalpak commented Apr 26, 2017

Copy link
Copy Markdown
Member

I don't see any difference with this PR (vs master). Positioning on mobile is probably already broken (see https://github.com/angular/angular/pull/16336/files#r113424809).
(Unless you mean something else.)

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

I fixed the mobile alignment. And I also made it invisible again.

@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Apr 26, 2017
@mary-poppins

Copy link
Copy Markdown

The angular.io preview for 8dbca6afbf7cfb0770d3b4491b8322bf48e669d2 is available here.

@sjtrimble

sjtrimble commented Apr 26, 2017 •

Copy link
Copy Markdown
Contributor

@petebacondarwin It wasn't my intent to put the anchor on the right :) but I know this might fix some of the header indentation issues for now. The side effect of your updates is having the h1 before element (the line under the h1) extend a bit further out than planned. Can we make the width 10% instead?

@petebacondarwin

petebacondarwin commented Apr 26, 2017 via email

Copy link
Copy Markdown
Contributor Author

@petebacondarwin

Copy link
Copy Markdown
Contributor Author

In our meeting we agreed to move the anchor back to the left side and change the CSS so that if the heading is inside a subsection the anchor is moved further left so that from a user's perspective the anchor always appears in the left gutter of the page.

@petebacondarwin petebacondarwin added state: WIP and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 26, 2017
@petebacondarwin
petebacondarwin force-pushed the aio-anchor-link-placement branch from 8dbca6a to dc8b9d4 Compare April 26, 2017 21:36
@petebacondarwin petebacondarwin changed the title fix(aio): place anchor links after heading text fix(aio): improve heading-anchor placement Apr 26, 2017
@mary-poppins

Copy link
Copy Markdown

The angular.io preview for dc8b9d4423cd66f4bc7b9fa4bfbb4ae79214676e is available here.

@wardbell

Copy link
Copy Markdown
Contributor

@petebacondarwin I like the new anchor-in-the-gutter. Looking forward to seeing it work with HTML heading tags as well as MD heading tags. Thanks!

This package will allow us to do complex post-processing
on the HTML that is rendered by Nunjucks.
Previously the CSS styling for material icons was too broad and affected
all instances of icons. This commit constrains the position of copy button
icons only to copy buttons.
The autolinking is now done on the `renderedContent` which means it also
captures and autolinks headings that were generated outside of markdown.
@petebacondarwin
petebacondarwin force-pushed the aio-anchor-link-placement branch from dc8b9d4 to e5f23ae Compare April 27, 2017 13:46
@petebacondarwin petebacondarwin added action: review The PR is still awaiting reviews from at least one requested reviewer and removed state: WIP labels Apr 27, 2017
@mary-poppins

Copy link
Copy Markdown

The angular.io preview for e5f23ae is available here.

/* Support for all WebKit browsers. */
-webkit-font-smoothing: antialiased;
/* Support for Safari and Chrome. */
text-rendering: optimizeLegibility;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does @sjtrimble know you did this? 😁

*
* Each plugin is a factory function that will be called with the "rehype" engine as `this`.
* The factory should return a function that takes a HAST and returns a `boolean` or `undefined`.
* The HAST can be mutated by the this function.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the this --> the or this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The this variable

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still think you meant "The HAST can be mutated by this function(where "this function" is the _"function that takes a HAST and returns abooleanorundefined`"_, which in turn is returned by the plugin factory function) 😁

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah :-)

@wardbell wardbell added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 28, 2017
@mhevery mhevery closed this in de25cfc Apr 28, 2017
@petebacondarwin
petebacondarwin deleted the aio-anchor-link-placement branch April 28, 2017 09:01
petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request May 1, 2017
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
The autolinking is now done on the `renderedContent` which means it also
captures and autolinks headings that were generated outside of markdown.

PR Close angular#16336
asnowwolf pushed a commit to asnowwolf/angular that referenced this pull request Aug 11, 2017
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
The autolinking is now done on the `renderedContent` which means it also
captures and autolinks headings that were generated outside of markdown.

PR Close angular#16336
juleskremer pushed a commit to juleskremer/angular that referenced this pull request Aug 28, 2017
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants