Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
feat: Focus title if title is empty #9608
I'm a little wary of the unintended remounts triggering focus grabs, but if anything it would be good for those to be surfaced (as disruptive as they might be) since the unintentionally surrounding this possibility should itself be considered a bug worth addressing.
A small thing, but it was a bit jarring for me to see the additional visual effect of the focused title (the border) when loading the editor. This is, of course, expected as a result of the title being auto-focused, though in the broader sense maybe we don't want to have such a heavy first impression. Worth iterating if it's sensed to be problematic.
Sep 7, 2018
I tested and focus automatically goes to the title on new posts, but that does not happen for pre-existing published or draft posts with an empty title. Is this the intended behavior?
Tested with Firefox 62.0, Safari 11.1.2, and Chrome 69.0.3497.92 on macOS 10.13.6.
That's the intended behaviour, yes. The idea is that any existing post that's been saved without a title was done so intentionally, so we don't focus the title in that case.
It would probably be nice if we eventually focused the last block on an existing page, but that's another issue
For now nothing should be focused on an existing post.
I'd like to propose to reconsider this for the demo post, if no objections? I'd tend to think the demo post should serve to familiarize with the whole UI. Skipping all the UI that's before the post title doesn't help screen reader users in discovering the features in the top bar. Actually, I'm not even sure if the demo post is meant to stay after merge, but what about checking explicitly if the post is empty? Something like
referenced this pull request
Oct 14, 2018
Ah, that's a really good point @afercia. I'm not sure it's staying either but before I thought that edge case of focusing the title on the demo was fine because I wanted to err toward simple code. As it serves as an introduction to the editor, not focusing it seems good.
I mean, on the other hand, it means the intro to the editor won't focus the title like a new post would, but then a post like the demo page that had been saved wouldn't focus either.
So yeah, I think that's a good point and we shouldn't focus it if a title is present.
I've filed: #10601 to track it.