mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-12-05 05:22:58 -05:00
Merge pull request #10820 from dotCooCoo/fix/new-document-name-label
New Document: the name field reads Document Name
This commit is contained in:
3 files changed
+30
-3
No files matched your search
@@ -806,8 +806,8 @@ impl VectorcraftApp {
|
||||
crate::place::window_files(app, ui);
|
||||
});
|
||||
// The shell shows the window's dialogs under these words. Temporary: removed once the craft-libs pin includes
|
||||
// storytold/craft-libs#4891 (`dialogs::print::title_words`).
|
||||
let words = dialogs::print::title_words(self).map(WordsOverride::Overlay);
|
||||
// storytold/craft-libs#4891 and #5291 (`dialogs::shell_words`).
|
||||
let words = dialogs::shell_words(self).map(WordsOverride::Overlay);
|
||||
let shown = with_env(ui, |env| env.words = words, |ui| shell.show(ui, self));
|
||||
chrome::set_control_bar_place(&mut self.ui, control_bar_place);
|
||||
if shown.screen_mode != given {
|
||||
|
||||
@@ -189,6 +189,15 @@ pub(crate) use export_for_screens::{
|
||||
};
|
||||
pub(crate) use new_document::preset_name;
|
||||
pub use new_document::{create_without_dialog as new_document_without_dialog, open as open_new_document};
|
||||
|
||||
/// The words the window's shell shows its dialogs under: the rows of the open dialogs whose framework words VectorCraft
|
||||
/// changes for now (`print::title_words`, `new_document::name_words`), or `None` when no such dialog is open.
|
||||
pub(crate) fn shell_words(app: &crate::VectorcraftApp) -> Option<craft::ui::runtime::env::WordRows> {
|
||||
[print::title_words(app), new_document::name_words(app)]
|
||||
.into_iter()
|
||||
.flatten()
|
||||
.reduce(|rows, more| more.iter().fold(rows, |rows, (word, text)| rows.row(word, text)))
|
||||
}
|
||||
pub use png_options::open as open_raster_options;
|
||||
pub use save_pdf::{open as open_save_pdf, open_preset as open_pdf_preset};
|
||||
pub use tools::open_tool_dialog;
|
||||
|
||||
@@ -35,7 +35,7 @@ use craft::ui::patterns::form_dialogs::{
|
||||
use craft::ui::patterns::presets::{GroupPath, NamedPresetEvent, PresetLibrary};
|
||||
use craft::ui::pickers::Select;
|
||||
use craft::ui::popover::Popover;
|
||||
use craft::ui::runtime::env::{Env, Label, LengthUnits, UnitKind};
|
||||
use craft::ui::runtime::env::{Env, Label, LengthUnits, UnitKind, WordRows};
|
||||
use craft::ui::sections::Section;
|
||||
use craft::ui::style::TypeRole;
|
||||
use craft::ui::text::{LinkMode, LinkedWords, NumberField, follow_equal, link_toggle};
|
||||
@@ -706,6 +706,14 @@ fn offered(app: &VectorcraftApp) -> VcNewDocument {
|
||||
})
|
||||
}
|
||||
|
||||
/// The words that name New Document's name field "Document Name" while the dialog is open, for the window's shell to
|
||||
/// show its dialogs under. The framework names the field "Name". Temporary: this is removed once the craft-libs pin
|
||||
/// includes storytold/craft-libs#5291, which names the field and gives Save Document Preset its save icon.
|
||||
pub(crate) fn name_words(app: &VectorcraftApp) -> Option<WordRows> {
|
||||
let open = app.dialogs()?.with(|host| host.is_open::<HostedNewDocument<VcNewDocument>>());
|
||||
open.then(|| WordRows::new().row(craft::i18n::Word::keyed("newDocument.name", "Name"), tl!("Document Name")))
|
||||
}
|
||||
|
||||
/// Open New Document on the most recent settings (or Letter), named after the next untitled
|
||||
/// document, in Preferences › Units › General.
|
||||
pub fn open(app: &mut VectorcraftApp) {
|
||||
@@ -1750,6 +1758,16 @@ mod tests {
|
||||
nodes.iter().find(|(r, n, _)| *r == role && n == name).map(|(_, _, b)| *b).unwrap_or_else(|| panic!("no {role:?} {name}"))
|
||||
}
|
||||
|
||||
/// The name field is named Document Name; before, screen readers read it as plain Name.
|
||||
#[test]
|
||||
fn new_document_names_its_name_field_document_name() {
|
||||
use egui::accesskit::Role;
|
||||
let nodes = dialog_nodes(1280.0, 900.0);
|
||||
let field = |name: &str| nodes.iter().any(|(role, label, _)| *role == Role::TextInput && label == name);
|
||||
assert!(field("Document Name"), "a text field named Document Name");
|
||||
assert!(!field("Name"), "no text field named plain Name");
|
||||
}
|
||||
|
||||
/// Every Preset Details label stands above its field, at the field's left edge; before, Width, Height,
|
||||
/// Orientation, Artboards, the Bleed sides and Background Contents sat right-aligned beside their fields.
|
||||
#[test]
|
||||
|
||||
Reference in new issue
Block a user