Skip to content

Commit 43f7cc9

Browse files
committed
Add HTML ARIA
1 parent e0553c3 commit 43f7cc9

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

apps/components_guide/lib/components_guide/research/spec.ex

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,24 @@ defmodule ComponentsGuide.Research.Spec do
2525
end
2626

2727
def search_for(:whatwg_html_spec, query) when is_binary(query) do
28-
IO.puts("searching whatwg html spec")
29-
3028
# url = "https://html.spec.whatwg.org/"
3129
url = "https://html.spec.whatwg.org/dev/"
3230

33-
# {:ok, html} = body({:fetch, url})
34-
# {:ok, html} = read({:fetch, url})
3531
{:ok, document} = Source.html_document_at(url)
3632

37-
# IO.puts("document size #{:erts_debug.flat_size(document)}")
38-
39-
# selector = css("#contents")
40-
# selector = xpath("//*[@id='contents']/following-sibling::ol[1]")
41-
# result = Meeseeks.one(document, selector)
42-
# Meeseeks.html(result)
43-
4433
document
4534
|> Floki.find("body")
4635
|> Floki.find("a:fl-contains('#{query}')")
4736
|> Floki.raw_html()
37+
end
4838

49-
# html
39+
def search_for(:html_aria_spec, query) when is_binary(query) do
40+
url = "https://www.w3.org/TR/html-aria/"
41+
{:ok, document} = Source.html_document_at(url)
42+
43+
document
44+
|> Floki.find("#document-conformance-requirements-for-use-of-aria-attributes-in-html table tbody tr")
45+
# |> Floki.find("#id-#{query}")
46+
|> Floki.raw_html()
5047
end
5148
end

apps/components_guide_web/lib/components_guide_web/controllers/research_controller.ex

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ defmodule ComponentsGuideWeb.ResearchController do
4646
content_tag(:article, [
4747
h2("Can I Use"),
4848
Spec.search_for(:caniuse, query) |> present_results()
49+
]),
50+
content_tag(:article, [
51+
h2("HTML ARIA"),
52+
Spec.search_for(:html_aria_spec, query) |> present_results()
4953
])
5054
]
5155
end

apps/components_guide_web/lib/components_guide_web/views/layout_view.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule ComponentsGuideWeb.LayoutView do
1818
~E"""
1919
<li>
2020
<form role=search action="/research" class="flex h-full px-2 items-center">
21-
<input type=text name=q placeholder="Search" class="w-full py-1 px-2 bg-white text-black">
21+
<input type=text name=q placeholder="Search specs" class="w-full py-1 px-2 bg-white text-black">
2222
</form>
2323
"""
2424
end

0 commit comments

Comments
 (0)