Toya0421 commited on
Commit
796eb3e
·
verified ·
1 Parent(s): 30f9eea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -2
app.py CHANGED
@@ -873,6 +873,57 @@ custom_css = """
873
  width: 100% !important;
874
  box-sizing: border-box !important;
875
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876
  """
877
 
878
  with gr.Blocks(css=custom_css, js=radio_js) as demo:
@@ -883,9 +934,9 @@ with gr.Blocks(css=custom_css, js=radio_js) as demo:
883
  student_id_input = gr.Textbox(label="学生番号(必須)")
884
 
885
  group_input = gr.Radio(
886
- choices=[("Group 1", 1), ("Group 2", 2)],
887
  label="実験グループを選択",
888
- value=2,
889
  elem_id="group_radio" # ★追加:Edgeでも確実に狙うため
890
  )
891
 
 
873
  width: 100% !important;
874
  box-sizing: border-box !important;
875
  }
876
+
877
+ /* ===============================
878
+ ★追加:Group選択中を確実に見えるように(Edge対応)
879
+ =============================== */
880
+
881
+ /* ラジオ自体がOS/ブラウザ依存で薄くなるのを防ぐ */
882
+ #group_radio input[type="radio"]{
883
+ appearance: auto !important;
884
+ -webkit-appearance: radio !important;
885
+ width: 18px !important;
886
+ height: 18px !important;
887
+ accent-color: #2563eb !important;
888
+ }
889
+
890
+ /* 各選択肢を行として見やすく */
891
+ #group_radio label{
892
+ width: 100% !important;
893
+ box-sizing: border-box !important;
894
+ padding: 10px 12px !important;
895
+ border-radius: 12px !important;
896
+ border: 1px solid #e5e7eb !important;
897
+ display: flex !important;
898
+ align-items: center !important;
899
+ gap: 10px !important;
900
+ }
901
+
902
+ /* ✅ checked のとき “行全体” をハイライト
903
+ (DOM差に備えて :has / input+span / input~span を全部用意)
904
+ */
905
+ @media (prefers-color-scheme: light){
906
+ #group_radio label:has(input[type="radio"]:checked){
907
+ background: #eef2ff !important;
908
+ border: 2px solid #4f46e5 !important;
909
+ }
910
+ #group_radio input[type="radio"]:checked + span,
911
+ #group_radio input[type="radio"]:checked ~ span{
912
+ font-weight: 700 !important;
913
+ }
914
+ }
915
+
916
+ @media (prefers-color-scheme: dark){
917
+ #group_radio label:has(input[type="radio"]:checked){
918
+ background: #1f2937 !important;
919
+ border: 2px solid #60a5fa !important;
920
+ }
921
+ #group_radio input[type="radio"]:checked + span,
922
+ #group_radio input[type="radio"]:checked ~ span{
923
+ font-weight: 700 !important;
924
+ }
925
+ }
926
+
927
  """
928
 
929
  with gr.Blocks(css=custom_css, js=radio_js) as demo:
 
934
  student_id_input = gr.Textbox(label="学生番号(必須)")
935
 
936
  group_input = gr.Radio(
937
+ choices=[("Group 1", "1"), ("Group 2", "2")],
938
  label="実験グループを選択",
939
+ value="2",
940
  elem_id="group_radio" # ★追加:Edgeでも確実に狙うため
941
  )
942