Skip to content

Maintenance: fix dead quotes API, tweet encoding, a11y and mobile layout - #1

Merged
fadyehabamer merged 6 commits into
masterfrom
maintenance/2026-09
Sep 24, 2026
Merged

fadyehabamer merged 6 commits into
masterfrom
maintenance/2026-09

Conversation

@fadyehabamer

Copy link
Copy Markdown
Owner

Summary

  • Fix broken quotes (main bug): https://type.fit/api/quotes still answers with 200, but it no longer sends an Access-Control-Allow-Origin header, so the browser blocks the request from the deployed site. It also returns only 5 quotes now. The app now uses https://dummyjson.com/quotes/random, which is CORS-enabled (it echoes the randomquote-app.vercel.app origin). The fetch checks res.ok, shows a fallback message when it fails, and disables Next while a request is in flight.
  • Tweet sharing: the tweet text is now URL-encoded, so quotes with &, # or ? are no longer cut off. Removed the leftover ?text=fady placeholder.
  • Accessibility: removed button:focus { outline: none } and added a :focus-visible outline for the button and the Tweet link. Decorative icons get aria-hidden, the quote gets aria-live="polite", the button gets type="button" and an aria-label, and the loader alt text is fixed.
  • Mobile: the card was a fixed 600px wide, which made phones scroll sideways. It now has max-width: calc(100% - 20px).
  • Meta and docs: added a meta description. The README now has a description, the live demo link, the API credit and run instructions.

CRLF line endings are kept, so the diffs show only the real changes.

Verification (static only, no browser)

  • node --check main.js passes
  • Ran main.js under Node with a stubbed DOM against the live API: it filled the quote, the author and an encoded tweet URL. With a stubbed failing fetch, it showed the fallback message and turned Next back on.
  • Parsed the HTML: tags balance, and every local src/href/url() (style.css, main.js, loader.svg, bck.jpg) exists
  • Used curl to check that dummyjson returns 200 with CORS for the site origin, the Font Awesome CDN returns 200, and the YouTube video still exists
  • Not checked visually: the focus outline style and the mobile layout.

Left for the owner

  • The full-screen .loader is never shown (it always has the hide class). Either wire it up or remove it along with loader.svg.
  • The Twitter/X intent URL and brand icon still work but could be updated to X.

…le fetch errors

type.fit/api/quotes no longer returns Access-Control-Allow-Origin (browser fetch is blocked) and now serves only 5 quotes. Switch to https://dummyjson.com/quotes/random, check res.ok, and show a fallback message on failure.
Quotes containing characters like '&' or '#' were truncated in the tweet intent. Also drop the leftover 'text=fady' placeholder from the initial link.
- Replace 'button:focus { outline: none }' with a :focus-visible outline for the Next button and Tweet link
- Style the disabled Next button while a quote is loading
- Mark decorative Font Awesome icons aria-hidden
- Announce new quotes with aria-live=polite
- Give the Next button type=button and a descriptive aria-label; fix loader alt text
The card had a fixed 600px width plus margins, causing horizontal scrolling on phones. Cap it at the viewport width minus its margins.
Copilot AI lite review requested due to automatic review settings September 24, 2026 11:12
@vercel

vercel Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
random-quote-generator Building Building Preview Sep 24, 2026 11:12am UTC

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot review overview

🟡 Changes recommended

Three moderate issues remain in tweet-link state and accessibility behavior.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity

Open (1)
What changed in this PR

Updates the quote app’s API integration, sharing, accessibility, responsive layout, and documentation.

Changes:

  • Replaces the broken quotes API with DummyJSON and adds error handling.
  • Encodes tweet text and improves accessibility behavior.
  • Adds responsive sizing, metadata, and README documentation.
File Summary
style.css Adds mobile sizing, focus styles, and disabled-state styling.
README.md Documents features, API credit, demo, and setup.
main.js Handles quote fetching and tweet URL generation; stale tweet links must be cleared on fetch failure.
index.html Adds metadata and accessibility markup; tweet-link activation and author announcements require updates.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread main.js
} catch (err) {
console.error(err)
text.innerText = "Couldn't load a quote. Please check your connection and try again."
author.innerText = ''
@fadyehabamer
fadyehabamer merged commit dcfb21d into master Sep 24, 2026
3 checks passed
@fadyehabamer
fadyehabamer deleted the maintenance/2026-09 branch September 24, 2026 12:59

This branch was successfully deployed

1 active deployment
Preview — 26dc42e1 Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants