Forem Creators and Builders 🌱

Cover image for Changelog: Accessibility, Features, Refactors, and Optimizations πŸŽ‰
Christina Gorton for Forem Core Team

Posted on

Changelog: Accessibility, Features, Refactors, and Optimizations πŸŽ‰

This cycle, our team focused on more accessibility improvements, added several features, and worked on refactoring code. This post is a round up of the latest changes from our repository.

Accessibility

Suggest Accessibility Enhancements to Posts

Our team worked on a feature to suggest accessibility improvements when a user writes a post.
The accessibility issues it detects are:

Autofocus Skip Links

This PR, by one of our community members, fixed an issue where Skip Links only functioned when landing on a URL, but not when using the keyboard to access internal links.

autofocus Skip Link on keyboard navigation #13828

What type of PR is this?

  • [ ] Refactor
  • [ ] Feature
  • [x] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

This PR aims to fix an issue where Skip Links only functioned when landing on a URL, not when using the keyboard to access internal links. With the added changes we are now sending focus immediately to the Skip Link when visitors are using a keyboard, and hiding it when a mouse is used.

QA Instructions, Screenshots, Recordings

Tested manually with keyboard and mouse on Edge, Chrome and Firefox. Ran checks using Axe DevTools and ANDI to ensure no unwanted behaviours have been introduced.

QA steps

  • go to the homepage
  • use the keyboard to navigate between pages and check that Skip Link appears on every link
  • use your mouse to navigate between pages and ensure that Skip Link does not appear
  • refresh the page and make sure Skip Link does not appear
  • press Tab and make sure Skip Link appears

Additional notes if you can't see the Skip Link in Firefox: On a Mac, making the Skip Link appear on Mozilla Firefox requires additional configuration. This post describes what you need to do, although there are a few missing steps. Follow the instructions on StackOverflow for setting up the keyboard behaviour on your Mac, then type about:config in Mozilla's URL bar. When you see the following message: Changing these preferences can impact Firefox performance or security, click 'Show all' at the top, type accessibility.tabfocus in the search bar, click the + icon to the right and update the number from 0 to 7, then click the tick icon on the right to save your changes. You should now be able to see the Skip Link on tab.

Demo https://user-images.githubusercontent.com/22390758/119253376-e53fde00-bba8-11eb-96e0-d17175d96ec0.mov

Added tests?

  • [ ] Yes
  • [x] No, and this is why: This PR only includes a CSS update and a small change to base.js.erb. I couldn't find any specs for this file, so I assumed the decision was to not test the behaviour defined here.
  • [ ] I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the development process, or any of our internal teams? If so, please note how you will share this change with the people who need to know about it.

  • [ ] I've updated the Developer Docs and/or Admin Guide, or Storybook (for Crayons components)
  • [ ] I've updated the README or added inline documentation
  • [X] I will share this change in a Changelog or in a forem.dev post
  • [ ] I will share this change internally with the appropriate teams
  • [ ] I'm not sure how best to communicate this change and need help
  • [ ] This change does not need to be communicated, and this is why not: please replace this line with details on why this change doesn't need to be shared

Features

Add Pinned Post to Feed

This new feature allows admins to pin a post to the main feed and unpin it.
Pinned post

Pin posts to feed #13807

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

This implements https://github.com/forem/rfcs/pull/25, "Add pinned post to feed".

The general requirements can be seen in this mockup:

mockup of how pin post to feed should work

  1. Admins can pin a post to the feed, then unpin it
  2. The pinned post surfaces at the top of the homepage feed (right now it's visible in all the feed views)
  3. Admins can pin a post from the admin panel and are asked a confirmation if there's already a pinned post

Potential gotcha: to go back to zero pinned post from the Admin, the user has to go back to the website and unpin the pinned post. There's no "remove pinned post".

Related Tickets & Documents

https://github.com/forem/rfcs/blob/main/text/0025-add-feed-pinned-posts.md

QA Instructions, Screenshots, Recordings

Pin and unpin a post

https://user-images.githubusercontent.com/146201/119876527-4577ac80-bf28-11eb-870f-a94b91268a33.mov

Admin: Pin the first post

https://user-images.githubusercontent.com/146201/119877024-d3ec2e00-bf28-11eb-86b2-12b490c7293d.mov

Admin: Pin a post when there's already a pinned post

https://user-images.githubusercontent.com/146201/119945049-4692f300-bf95-11eb-867c-33d854b83b9d.mov

UI accessibility concerns?

If your PR includes UI changes, please replace this line with details on how accessibility is impacted and tested. For more info, check out the Forem Accessibility Docs.

Added tests?

  • [x] Yes, but I need help on some of them
  • [ ] No, and this is why: please replace this line with details on why tests have not been included
  • [ ] I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the development process, or any of our internal teams? If so, please note how you will share this change with the people who need to know about it.

  • [ ] I've updated the Developer Docs and/or Admin Guide, or Storybook (for Crayons components)
  • [ ] I've updated the README or added inline documentation
  • [x] I will share this change in a Changelog or in a forem.dev post
  • [ ] I will share this change internally with the appropriate teams
  • [ ] I'm not sure how best to communicate this change and need help
  • [ ] This change does not need to be communicated, and this is why not: please replace this line with details on why this change doesn't need to be shared

Lock Discussions on Posts

Authors and site admins can now lock discussions on posts to prevent comments from being added.
locked

Check out the changelog post by Alex Smith to see how to lock a comment thread.

Prioritize Article Titles in Search Results

This PR adds back functionality in search to match terms in a post's title.

Search results: prioritize articles titles #13918

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [x] Feature
  • [x] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

This PR re-introduces weights on different columns. We used to weigh in this order with Elasticsearch:

1 - title 2 - body markdown 3 - tags names 4 - everything else

Related Tickets & Documents

Refers to https://github.com/forem/forem/issues/13746

(Doesn't close it as there's additional UI work that will be implemented in a separate PR)

QA Instructions, Screenshots, Recordings

  1. Choose a sentence
  2. Create a few articles: use the sentence for the title for one article, the body for another and yet another
  3. Search for that entire sentence in the search box
  4. Check that the article using the sentence as its title appears first in the search results than the others
  5. You can repeat a similar approach with a tag: create two articles, one with the tag as a tag, one with the name of the tag in the body, search for that tag and ensure the tagged article comes first than the article where the tag name appears in the body
  6. Ensure the "Newest" and "Oldest" selectors keep working

Added tests?

  • [x] Yes
  • [ ] No, and this is why: please replace this line with details on why tests have not been included
  • [ ] I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the development process, or any of our internal teams? If so, please note how you will share this change with the people who need to know about it.

  • [ ] I've updated the Developer Docs and/or Admin Guide, or Storybook (for Crayons components)
  • [ ] I've updated the README or added inline documentation
  • [x] I will share this change in a Changelog or in a forem.dev post
  • [ ] I will share this change internally with the appropriate teams
  • [ ] I'm not sure how best to communicate this change and need help
  • [ ] This change does not need to be communicated, and this is why not: please replace this line with details on why this change doesn't need to be shared

Refactoring

Remove shop_url from SiteConfig βœ‚οΈ βœ‚οΈ βœ‚οΈ βœ‚οΈ

This PR removes the "Shop URL" field from admin's config as well all related code. To learn more about why this was removed please refer to the PR.

βœ‚βœ‚βœ‚ Remove `shop_url` from `SiteConfig` βœ‚βœ‚βœ‚ #13773

What type of PR is this? (check all applicable)

  • [X] Refactor

Description

This PR removes shop_url from SiteConfig and also all the related code. This is better handled via a NavigationLink.

Related Tickets & Documents

#13583

QA Instructions, Screenshots, Recordings

Nothing specific, just removing code.

UI accessibility concerns?

None

Added tests?

  • [X] Yes: updated/deleted exsisting

[Forem core team only] How will this change be communicated?

  • [x] I will share this change internally with the appropriate teams

API: Remove Admin Config Endpoint βœ‚οΈ βœ‚οΈ βœ‚οΈ βœ‚οΈ

The admin config endpoint no longer made sense in its current form. For that reason it will be removed until the requirements for it can be better solidified.

API: Remove Admin Config endpoint βœ‚οΈ βœ‚οΈ βœ‚οΈ βœ‚οΈ #13934

What type of PR is this? (check all applicable)

  • [ ] Refactor
  • [x] Feature
  • [ ] Bug Fix
  • [ ] Optimization
  • [ ] Documentation Update

Description

The current /api/admin/config endpoint is broken due to how we changed how config/settings works. We've decided to remove it, see https://github.com/forem/forem/issues/13843#issuecomment-854313973 for further details

Related Tickets & Documents

https://github.com/forem/forem/issues/13843#issuecomment-854313973

Added tests?

  • [ ] Yes
  • [x] No, and this is why: just removing code
  • [ ] I need help with writing tests

[Forem core team only] How will this change be communicated?

Will this PR introduce a change that impacts Forem members or creators, the development process, or any of our internal teams? If so, please note how you will share this change with the people who need to know about it.

  • [ ] I've updated the Developer Docs and/or Admin Guide, or Storybook (for Crayons components)
  • [ ] I've updated the README or added inline documentation
  • [x] I will share this change in a Changelog or in a forem.dev post
  • [ ] I will share this change internally with the appropriate teams
  • [ ] I'm not sure how best to communicate this change and need help
  • [ ] This change does not need to be communicated, and this is why not: please replace this line with details on why this change doesn't need to be shared

Optimization

This PR sets a rate limit to the number of @-mentions allowed in a post which can be changed in the /admin/customization/config.

Replace MAX_USER_MENTIONS with Settings::RateLimit.mention_creation #13736

What type of PR is this? (check all applicable)

  • [x] Optimization

Description

Addresses this TODO now that RFC #22 has been completed with https://github.com/forem/forem/pull/13367 https://github.com/forem/forem/blob/11bab732c0ff477b177495e4e1ee9b979c24be9b/app/models/article.rb#L28-L30

Also removes my name from all the TODOs I added previously for myself 😿

Related Tickets & Documents

Follow up task to RFC #22

QA Instructions, Screenshots, Recordings

  1. Check that you cannot create a post with more than 7 @-mentions (this is the default value for Settings::RateLimit.mention_creation):

Screen Shot 2021-05-11 at 2 41 53 PM

  1. Check that you can create a post with 7 or fewer @-mentions:

Screen Shot 2021-05-11 at 2 42 01 PM

  1. Check that you cannot create a comment with more than 7 @-mentions

Screen Shot 2021-05-11 at 2 42 22 PM

  1. Check that you can create a comment with 7 or fewer @-mentions:

Screen Shot 2021-05-11 at 2 42 37 PM

  1. Go to the admin view /admin/customization/config, and check that you can see the limit for @-mentions in a post or comment in the "rate limit and antispam" section:

Screen Shot 2021-05-11 at 2 43 39 PM

  1. Try changing that value and updating the config:

Screen Shot 2021-05-11 at 2 44 06 PM

You should now only be able to create up to the new number of max mentions that you just set πŸ˜ƒ

UI accessibility concerns?

A backend change, so...none!

Added tests?

  • [x] Yes

[Forem core team only] How will this change be communicated?

  • [x] I've updated the README or added inline documentation
  • [x] I will share this change in a Changelog or in a forem.dev post
  • [x] I will share this change internally with the appropriate teams

Are there any post deployment tasks we need to perform?

I don't think we have any; Settings::RateLimits are already in production, so everything should Just Workℒ️

Top comments (2)

Collapse
 
thomasbnt profile image
Thomas Bnt • Edited

The lock disussion is...
BOOOOOOOOOM

Mean very cool feature for old posts or from passed discussions events!

Collapse
 
michaeltharrington profile image
Michael Tharrington

So many good features released here!