fix: enable wrapping of long option names in facets
2 files changed, 12 insertions(+), 3 deletions(-)
M frontend/static/style.css → frontend/static/style.css
@@ -216,7 +216,6 @@ .facet .term { display: flex; justify-content: space-between; border-bottom: 1px solid transparent; - overflow-wrap: break-word; padding: 0.25rem 0; margin-right: 0; }
M internal/components/results.go → internal/components/results.go
@@ -3,6 +3,7 @@ import ( "maps" "slices" + "strings" "github.com/blevesearch/bleve/v2/search"@@ -78,11 +79,11 @@ r.SearchNav.HasFacet(facet.Field, term.Term), A( Href(r.SearchNav.RemoveFacet(facet.Field, term.Term)), TitleAttr("remove"), - g.Text(t), + g.Text(breakable(t)), ), A( Href(r.SearchNav.AddFacet(facet.Field, term.Term)), - g.Text(t), + g.Text(breakable(t)), ), ), Span(@@ -100,6 +101,15 @@ ), ), ) }), + ) +} + +const breakOpportunity = string(rune(0x200b)) + +func breakable(s string) string { + return strings.Join( + strings.Split(s, "."), + "."+breakOpportunity, ) }