Skip to content

Commit

Permalink
feat: Add audible form closed announce
Browse files Browse the repository at this point in the history
chore: Remove un-necessary aria-label from overlay container
  • Loading branch information
TatuLund committed Dec 27, 2024
1 parent e782914 commit a0ae138
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ public void attach() {
super.attach();
// Workaround: https://github.com/vaadin/framework/issues/5772
getPage().getJavaScript().execute(
"setTimeout(() => document.getElementsByClassName('v-tooltip')[0].style.zIndex=30001, 200);");
"""
setTimeout(() => {
document.getElementsByClassName('v-tooltip')[0].style.zIndex=30001;
document.getElementsByClassName('v-overlay-container')[0].removeAttribute('aria-label');
}, 200);
""");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,9 @@ public void showForm(boolean visible) {
clearDirtyIndicators();
}
sidePanel.show(visible);
if (!visible) {
VaadinCreateUI.get().announce(getTranslation(I18n.CLOSED));
}
}

public Product getProduct() {
Expand Down Expand Up @@ -407,12 +410,10 @@ public void editProduct(Product product) {
presenter.requestUpdateCategories();
if (product == null) {
product = new Product();
readProduct(product);
return;
}
deleteButton.setEnabled(product.getId() != null);
currentProduct = product;
binder.readBean(product);
saveButton.setEnabled(false);
discardButton.setEnabled(false);
readProduct(product);

// Scroll to the top
// As this is not a Panel, using JavaScript
Expand All @@ -426,6 +427,14 @@ public void editProduct(Product product) {
announceProductOpened(product);
}

private void readProduct(Product product) {
deleteButton.setEnabled(product.getId() != null);
currentProduct = product;
binder.readBean(product);
saveButton.setEnabled(false);
discardButton.setEnabled(false);
}

// This is horrible, but required to workaround a bug in NVDA
private void announceProductOpened(Product product) {
if (isAttached()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ private I18n() {
public static final String CURRENT_PAGE = "current-page";
public static final String OPENED = "opened";
public static final String CONFIRM = "confirm";
public static final String CLOSED = "closed";

public static final class Books {
public static final String UPDATED = "updated";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,3 +96,4 @@ ready = bereit
product-form = buchform
opened = geöffnet
current-page = aktuelle seite
closed = buchform geschlossen
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,5 @@ ready = ready
product-form = bookform
opened = opened
current-page = current page
closed = product form closed
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ ready = valmis
product-form = tuotelomake
opened = avattu
current-page = nykyinen sivu
closed = tuote lomake suljettu

0 comments on commit a0ae138

Please sign in to comment.